Issue #8426 has been updated by sam.saffron (Sam Saffron).


Here are some raw benches comparing Ruby-Head with KclassCache

TLDR;

Noticeable improvement over head.

Discourse topic list page: 69 median -> 65 median , 78.3 mean -> 67.4 mean
Discourse topic page: 51 median  -> 48 median , 57 mean -> 50 mean 

HEAD 

sam@ubuntu:~/Source/discourse$ ab -n 200 http://l.discourse/t/quote-reply-gets-in-the-way/1495
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking l.discourse (be patient)
Completed 100 requests
Completed 200 requests
Finished 200 requests


Server Software:        nginx/1.2.6
Server Hostname:        l.discourse
Server Port:            80

Document Path:          /t/quote-reply-gets-in-the-way/1495
Document Length:        54925 bytes

Concurrency Level:      1
Time taken for tests:   11.406 seconds
Complete requests:      200
Failed requests:        0
Write errors:           0
Total transferred:      11059400 bytes
HTML transferred:       10985000 bytes
Requests per second:    17.53 [#/sec] (mean)
Time per request:       57.032 [ms] (mean)
Time per request:       57.032 [ms] (mean, across all concurrent requests)
Transfer rate:          946.86 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       0
Processing:    49   57  23.4     50     184
Waiting:       49   57  23.4     50     184
Total:         49   57  23.4     51     184

Percentage of the requests served within a certain time (ms)
  50%     51
  66%     52
  75%     53
  80%     54
  90%     59
  95%     82
  98%    166
  99%    174
 100%    184 (longest request)


sam@ubuntu:~/Source/discourse$ ab -n 200 http://l.discourse/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking l.discourse (be patient)
Completed 100 requests
Completed 200 requests
Finished 200 requests


Server Software:        nginx/1.2.6
Server Hostname:        l.discourse
Server Port:            80

Document Path:          /
Document Length:        44604 bytes

Concurrency Level:      1
Time taken for tests:   15.667 seconds
Complete requests:      200
Failed requests:        0
Write errors:           0
Total transferred:      8986000 bytes
HTML transferred:       8920800 bytes
Requests per second:    12.77 [#/sec] (mean)
Time per request:       78.335 [ms] (mean)
Time per request:       78.335 [ms] (mean, across all concurrent requests)
Transfer rate:          560.12 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       0
Processing:    67   78  33.8     69     232
Waiting:       67   78  33.8     68     232
Total:         67   78  33.8     69     232

Percentage of the requests served within a certain time (ms)
  50%     69
  66%     69
  75%     69
  80%     70
  90%     73
  95%    205
  98%    210
  99%    212
 100%    232 (longest request)
sam@ubuntu:~/Source/discourse$ 


KCLASS_CACHE

sam@ubuntu:~/Source/discourse$ ab -n 200 http://l.discourse/t/quote-reply-gets-in-the-way/1495
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking l.discourse (be patient)
Completed 100 requests
Completed 200 requests
Finished 200 requests


Server Software:        nginx/1.2.6
Server Hostname:        l.discourse
Server Port:            80

Document Path:          /t/quote-reply-gets-in-the-way/1495
Document Length:        54925 bytes

Concurrency Level:      1
Time taken for tests:   10.010 seconds
Complete requests:      200
Failed requests:        0
Write errors:           0
Total transferred:      11059400 bytes
HTML transferred:       10985000 bytes
Requests per second:    19.98 [#/sec] (mean)
Time per request:       50.049 [ms] (mean)
Time per request:       50.049 [ms] (mean, across all concurrent requests)
Transfer rate:          1078.97 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       0
Processing:    45   50  15.1     48     227
Waiting:       45   50  15.1     47     226
Total:         45   50  15.1     48     227

Percentage of the requests served within a certain time (ms)
  50%     48
  66%     48
  75%     48
  80%     48
  90%     49
  95%     70
  98%     99
  99%    101
 100%    227 (longest request)
sam@ubuntu:~/Source/discourse$ 



sam@ubuntu:~/Source/discourse$ ab -n 200 http://l.discourse/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking l.discourse (be patient)
Completed 100 requests
Completed 200 requests
Finished 200 requests


Server Software:        nginx/1.2.6
Server Hostname:        l.discourse
Server Port:            80

Document Path:          /
Document Length:        44604 bytes

Concurrency Level:      1
Time taken for tests:   13.480 seconds
Complete requests:      200
Failed requests:        0
Write errors:           0
Total transferred:      8986000 bytes
HTML transferred:       8920800 bytes
Requests per second:    14.84 [#/sec] (mean)
Time per request:       67.403 [ms] (mean)
Time per request:       67.403 [ms] (mean, across all concurrent requests)
Transfer rate:          650.97 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       0
Processing:    62   67  14.5     65     225
Waiting:       62   67  14.5     65     225
Total:         62   67  14.5     65     225

Percentage of the requests served within a certain time (ms)
  50%     65
  66%     65
  75%     66
  80%     66
  90%     67
  95%     86
  98%    115
  99%    115
 100%    225 (longest request)
sam@ubuntu:~/Source/discourse$ 



----------------------------------------
Feature #8426: Implement class hierarchy method caching
https://bugs.ruby-lang.org/issues/8426#change-39447

Author: charliesome (Charlie Somerville)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 


=begin
This patch adds class hierarchy method caching to CRuby. This is the algorithm used by JRuby and Rubinius.

Currently, Ruby's method caches can only be expired globally. This means libraries that dynamically define methods or extend objects at runtime (eg. OpenStruct) can cause quite a significant performance hit.

With this patch, each class carries a monotonically increasing sequence number. Whenever an operation which would ordinarily cause a global method cache invalidation is performed, the sequence number on the affected class and all subclasses (classes hold weak references to their subclasses) is incremented, invalidating only method caches for those classes.

In this patch I've also split the (({getconstant})) VM instruction into two separate instructions - (({getclassconstant})) and (({getcrefconstant})). It's hoped that (({getclassconstant})) can start using class hierarchy caching with not much more effort. This change does affect compatibility in a minor way. Without this patch, (({nil::SomeConstant})) will look up (({SomeConstant})) in the current scope in CRuby (but not JRuby or Rubinius). With this patch, (({nil::SomeConstant})) will raise an exception.

The patch and all its commits can be viewed here: https://github.com/charliesome/ruby/compare/trunk...klasscache-trunk

Big thanks to James Golick, who originally wrote this patch for Ruby 1.9.3.
=end


-- 
http://bugs.ruby-lang.org/