Re: [julia-users] Exception Efficiency

2014-06-16 Thread Isaiah Norton
Not an answer to your questions, but: you might want to keep an eye on (or
try out) this patch exposing labels and gotos at the user level. It was
developed by Daniel Jones for parser backend purposes, and might be useful
for a regex engine:

https://github.com/JuliaLang/julia/pull/5699

(I believe it is going to be merged, just a question of when)


On Thu, Jun 5, 2014 at 8:22 PM, andrew cooke and...@acooke.org wrote:

 in the docs it says that exceptions in julia are implemented using tasks.

 can i take that to mean that they come with a significant overhead?

 and do you pay for that overhead even if the exception is not thrown?

 in particular, what is the best way to handle errors in fairly tight loops:
  1 - exceptions
  2 - maybe types (ie unions with nothing)
  3 - (flag, result) tuples (result is not a union but you have a tuple to
 unpack)
 and does that change if the excptions are common (say, 10% of loops) or
 rare (0.1%)?

 the reason i ask is that i am thinking of writing a regular expression
 engine in julia (i know it already has an interface to pcre, but it might
 be cool to have regular expressions over things other than characters, for
 example).  that needs an efficient inner loop, but is also fairly complex,
 and i'm trying to sketch out how things might work.

 thanks,
 andrew



Re: [julia-users] Exception Efficiency

2014-06-16 Thread andrew cooke

interesting thanks!

On Monday, 16 June 2014 10:09:00 UTC-4, Isaiah wrote:

 Not an answer to your questions, but: you might want to keep an eye on (or 
 try out) this patch exposing labels and gotos at the user level. It was 
 developed by Daniel Jones for parser backend purposes, and might be useful 
 for a regex engine:

 https://github.com/JuliaLang/julia/pull/5699

 (I believe it is going to be merged, just a question of when)


 On Thu, Jun 5, 2014 at 8:22 PM, andrew cooke and...@acooke.org 
 javascript: wrote:

 in the docs it says that exceptions in julia are implemented using tasks.

 can i take that to mean that they come with a significant overhead?

 and do you pay for that overhead even if the exception is not thrown?

 in particular, what is the best way to handle errors in fairly tight 
 loops:
  1 - exceptions
  2 - maybe types (ie unions with nothing)
  3 - (flag, result) tuples (result is not a union but you have a tuple to 
 unpack)
 and does that change if the excptions are common (say, 10% of loops) or 
 rare (0.1%)?

 the reason i ask is that i am thinking of writing a regular expression 
 engine in julia (i know it already has an interface to pcre, but it might 
 be cool to have regular expressions over things other than characters, for 
 example).  that needs an efficient inner loop, but is also fairly complex, 
 and i'm trying to sketch out how things might work.

 thanks,
 andrew




[julia-users] Exception Efficiency

2014-06-05 Thread andrew cooke
in the docs it says that exceptions in julia are implemented using tasks.

can i take that to mean that they come with a significant overhead?

and do you pay for that overhead even if the exception is not thrown?

in particular, what is the best way to handle errors in fairly tight loops:
 1 - exceptions
 2 - maybe types (ie unions with nothing)
 3 - (flag, result) tuples (result is not a union but you have a tuple to 
unpack)
and does that change if the excptions are common (say, 10% of loops) or 
rare (0.1%)?

the reason i ask is that i am thinking of writing a regular expression 
engine in julia (i know it already has an interface to pcre, but it might 
be cool to have regular expressions over things other than characters, for 
example).  that needs an efficient inner loop, but is also fairly complex, 
and i'm trying to sketch out how things might work.

thanks,
andrew