I found wxruby2.so in mingw release a bit large (18M), it is smaller
(~15M) after stripping symbols. I learned this from
http://wiki.wxwidgets.org/Reducing_Executable_Size . The command line
is:
strip --strip-all wxruby2.so
But I don't know whether there is a problem with stripping, at least my
app still runs well with the stripped one.
---
The loading of wxruby is not very fast too(~ 1.3s on my machine). After
a small profile, I found the following code in wx.rb the bottle-neck:
require 'wx/classes/evthandler.rb'
class_files = File.join( File.dirname(__FILE__), 'wx', 'classes',
'*.rb')
Dir.glob(class_files) do | class_file |
require 'wx/classes/' + class_file[/\w+\.rb$/]
end
A simple improvement is to make wx/classes/*.rb into one.
I wrote the following script, placed it under wx/, then run it to
generate a new classes.rb containing most classes under wx/classes/
data = []
(Dir.glob('classes/*.rb') - [
'classes/evthandler.rb',
'classes/simplehelpprovider.rb',
'classes/bitmap.rb'
]).each do |f|
data.push File.read f
end
File.open 'classes.rb', 'w' do |f|
f.puts data.join "\n"
end
Then I changed the classes loading section in wx.rb with:
require 'wx/classes/evthandler.rb'
require 'wx/classes.rb'
After this modification, the loading time seems shorter (reduced to ~
0.4s on my machine).
on 2010-02-04 15:22
on 2010-02-08 19:23
Hi Lui, 2010/2/4 Lui Kore <lists@ruby-forum.com>: > I found wxruby2.so in mingw release a bit large (18M), it is smaller > (~15M) after stripping symbols. I learned this from > http://wiki.wxwidgets.org/Reducing_Executable_Size . The command line > is: > > strip --strip-all wxruby2.so We already use strip -x. But strip --strip-all seems to reduce the size a little more. I'll try and see if there is no problem. > A simple improvement is to make wx/classes/*.rb into one. > I wrote the following script, placed it under wx/, then run it to > generate a new classes.rb containing most classes under wx/classes/ Interesting. I'll take a look at it. Cheers. Chauk-Mean.
on 2010-09-09 22:09
Hi Lui, 2010/2/4 Lui Kore <lists@ruby-forum.com>: > A simple improvement is to make wx/classes/*.rb into one. > I wrote the following script, placed it under wx/, then run it to > generate a new classes.rb containing most classes under wx/classes/ > Sorry for such a long delay ... I've tested your suggestion and indeed the loading is a bit faster. But the improvement is only about 10-11% on my system according to a Benchmark.measure of a require 'wx'. I don't know yet if it is worth adding a rake task for generating the classes.rb automatically even if I've already written it. Does anybody has an opinion on the subject ? Cheers. Chauk-Mean.
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.