From: Takashi Kokubun Date: 2019-01-19T01:22:22+09:00 Subject: [ruby-core:91159] Re: Testing MJIT on RHEL 7.5 Hi, > time /usr/local/ruby-edge/bin/ruby --disable-gems --jit -e "5000000.times { 3 * 123 }" > real 0m0.229s 229ms is too short to measure JIT-ed code's performance. Because of this: $ time ./ruby --disable-gems -e "" ./ruby --disable-gems -e "" 0.00s user 0.00s system 95% cpu 0.005 total $ time ./ruby --disable-gems --jit -e "" ./ruby --disable-gems --jit -e "" 0.12s user 0.02s system 100% cpu 0.135 total large amount of time you measure would be just time consumed for stopping JIT thread. This behavior is limitation of JIT-ing by invoking C compiler, and this is something intentional for now. Due to that, what we can do for now is just like (this is ruby 2.6.0 x86_64-linux): $ time ./ruby --disable-gems -e "500000000.times { 3 * 123 }" ./ruby --disable-gems -e "500000000.times { 3 * 123 }" 13.24s user 0.00s system 99% cpu 13.242 total $ time ./ruby --disable-gems --jit -e "500000000.times { 3 * 123 }" ./ruby --disable-gems --jit -e "500000000.times { 3 * 123 }" 10.13s user 0.02s system 101% cpu 9.989 total Best, k0kubun 2019���1���18���(���) 10:34 Phil Edelbrock : > > > Hello, I'm new to this list. I hope this is the right place to ask questions about the new experimental JIT implementation (which looks incredibly cool). > > First, I've got both 2.6.0 installed and the latest from github (which I call 'edge') on RHEL 7.5: > > [pedelbro@966629-app3 ~]$ /usr/local/ruby-2.6.0/bin/ruby -v > ruby 2.6.0p0 (2018-12-25 revision 66547) [x86_64-linux] > [pedelbro@966629-app3 ~]$ /usr/local/ruby-edge/bin/ruby -v > ruby 2.7.0dev (2019-01-16 trunk 66836) [x86_64-linux] > > gcc: > > Thread model: posix > gcc version 4.8.5 20150623 (Red Hat 4.8.5-28) (GCC) > > My /tmp is mounted (by default) as NOEXEC, so I created a regular directory in my home directory to get around the permissions error/warning: > > MJIT warning: failure in loading code from '/tmp/_ruby_mjit_p108878u0.so': /tmp/_ruby_mjit_p108878u0.so: failed to map segment from shared object: Operation not permitted > > So, now things seem better: > > MJIT: CC defaults to /usr/bin/gcc > MJIT: tmp_dir is /home/pedelbro/my_tmp > Creating precompiled header > Starting process: /usr/bin/gcc /usr/bin/gcc -std=gnu99 -w -Wfatal-errors -fPIC -shared -w -pipe -O3 -nodefaultlibs -nostdlib -o /home/pedelbro/my_tmp/_ruby_mjit_hp116911u0.h.gch /usr/local/ruby-edge/include/ruby-2.7.0/x86_64-linux/rb_mjit_min_header-2.7.0.h > start compilation: block in
@-e:1 -> /home/pedelbro/my_tmp/_ruby_mjit_p116911u0.c > Starting process: /usr/bin/gcc /usr/bin/gcc -std=gnu99 -w -Wfatal-errors -fPIC -shared -w -pipe -O3 -o /home/pedelbro/my_tmp/_ruby_mjit_p116911u0.o /home/pedelbro/my_tmp/_ruby_mjit_p116911u0.c -c -lgcc -Wl,--compress-debug-sections=zlib -nostartfiles -nodefaultlibs -nostdlib > Starting process: /usr/bin/gcc /usr/bin/gcc -std=gnu99 -shared -Wfatal-errors -fPIC -shared -w -pipe -O3 -o /home/pedelbro/my_tmp/_ruby_mjit_p116911u0.so /home/pedelbro/my_tmp/_ruby_mjit_p116911u0.o -lgcc -Wl,--compress-debug-sections=zlib -nostartfiles -nodefaultlibs -nostdlib > JIT success (37.9ms): block in
@-e:1 -> /home/pedelbro/my_tmp/_ruby_mjit_p116911u0.c > > When testing, though, I only see slowdowns when turning on JIT? > > This is a simple (and maybe a bad) example: > > [pedelbro@966629-app3 models]$ time /usr/local/ruby-edge/bin/ruby --disable-gems --jit -e "5000000.times { 3 * 123 }" > > real 0m0.229s > user 0m0.383s > sys 0m0.049s > [pedelbro@966629-app3 models]$ time /usr/local/ruby-edge/bin/ruby --disable-gems -e "5000000.times { 3 * 123 }" > > real 0m0.208s > user 0m0.203s > sys 0m0.004s > > Thanks! Let me know if this is the wrong list to discuss this. I hope to be another datapoint for testing, if it helps. :') > > > Phil > > Unsubscribe: > Unsubscribe: