Issue #5767 has been updated by funny_falcon (Yura Sokolov).


> The proposal is COMPLETELY compatible?

This proposal is completely compatible, since LOAD_PATH remains the same array, methods are overridden only to keep cache in sync.

Proposal is about keeping result of expanding LOAD_PATH entries in a 'invisible' cache.
This cache is lazy invalidated on changing directory and filesystem encoding, so that
the whole semantic of LOAD_PATH remains the same.
Methods of LOAD_PATH overridden to keep cache in sync, so that there is no need to expand
all paths again if entries were only appended to any side of LOAD_PATH, or removed from any side.

It saves up to 35% of big application's startup time and still brings slight improvement
 for small scripts.

(Only Jeremy Evan's sequel use self crafted super fast load system which does not gain improvement from this patch)

I didn't check it against current trunk, but believe there could not be big problems.

There is still small room for improvement this patch: make chached expanded paths class to be
subclass of String, and then test against it in a file_expand_path, so that to not expand it
twice in calls from rb_find_file_ext_safe and rb_find_file_safe.

Yura aka funny_falcon
----------------------------------------
Feature #5767: Cache expanded_load_path to reduce startup time
https://bugs.ruby-lang.org/issues/5767#change-25523

Author: funny_falcon (Yura Sokolov)
Status: Assigned
Priority: Normal
Assignee: nobu (Nobuyoshi Nakada)
Category: 
Target version: 


This patch add caching of expanded load path.
It reduces rails startup time by 33%
(patch against 1.9.3-p0 and simple performance test is here https://gist.github.com/1480404 )


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