Charles Oliver Nutter wrote:
In order to get rescue working correctly, and to fix a growing problem with exception backtraces repeating the same entry for multiple levels, I've had to saddle the compiler with a perf penalty: for each new line of code, it's constructing a SimpleSourcePosition object to track the current line. This will be temporary until I can find a way to repurpose the Java stack trace for Ruby backtraces (since all necessary info is there). In the short term, however, it's worth it to get the compiler completely functional.
r4367: I have eliminated this cost now, or at least eliminated it from execution. Instead of constructing a SimpleSourcePosition every time the script needs to update ThreadContext with the correct position, it now loads from a static field initialized once at class load. This has put perf numbers back where they were before the change. Static memory usage would be a bit higher now, with one SimpleSourcePosition for every distinct, code-containing file/line combination, but those are the breaks. If we come up with a better way to represent the current position in ThreadContext, we may be able to eliminate this.
Before: Control: 1m loops accessing a local variable 100 times 1.966000 0.000000 1.966000 ( 1.965000) 1.773000 0.000000 1.773000 ( 1.773000) 1.643000 0.000000 1.643000 ( 1.643000) 1.743000 0.000000 1.743000 ( 1.743000) 1.651000 0.000000 1.651000 ( 1.651000) Test STI: 1m loops accessing a fixnum var and calling to_i 100 times 6.249000 0.000000 6.249000 ( 6.249000) 5.559000 0.000000 5.559000 ( 5.559000) ... After: Control: 1m loops accessing a local variable 100 times 0.416000 0.000000 0.416000 ( 0.415000) 0.246000 0.000000 0.246000 ( 0.246000) 0.203000 0.000000 0.203000 ( 0.203000) 0.192000 0.000000 0.192000 ( 0.193000) 0.193000 0.000000 0.193000 ( 0.193000) Test STI: 1m loops accessing a fixnum var and calling to_i 100 times 5.000000 0.000000 5.000000 ( 5.001000) 4.560000 0.000000 4.560000 ( 4.561000) 4.506000 0.000000 4.506000 ( 4.506000) - Charlie --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email
