Case 1: Ruby + Ruby-MemCache + onboard memcache (the cache) - 10.5 seconds Case 2: Python + REMOTE memcache (the same cache as the other) - 0.2seconds Please please tell me I''m doing something very wrong... - and examples of the right way would be great. m -- here''s my code: require ''memcache'' mem = MemCache.new ''10.253.9.158'' #mem = MemCache.new ''127.0.0.1'' t1=Time.new list1 = mem[''red''] list2 = mem[''car''] t2=Time.new puts (t2.to_f - t1.to_f).to_s list3 = list1.split('':'') & list2.split('':'') t3 = Time.new puts (t3.to_f - t2.to_f).to_s puts list3 t4 = Time.new puts (t4.to_f - t3.to_f).to_s --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Fri, 14 Sep 2007, Marc Byrd wrote:> Case 1: Ruby + Ruby-MemCache + onboard memcache (the cache) - 10.5 seconds > > Case 2: Python + REMOTE memcache (the same cache as the other) - 0.2seconds > > Please please tell me I''m doing something very wrong... - and examples of > the right way would be great.Try memcache-client instead... http://dev.robotcoop.com/Libraries/memcache-client/index.html It''s supposed to be a lot faster... Also, if this is on a mac and you''re using memcache 1.2.0 recompile it and tweak the following: # edit memcached.h and add ''#undef NO_TCPPUSH'' to the top Can''t remember where exactly I read that, but it makes a huge difference.> > m > -- > here''s my code: > > require ''memcache'' > > > mem = MemCache.new ''10.253.9.158'' > #mem = MemCache.new ''127.0.0.1'' > > t1=Time.new > list1 = mem[''red''] > list2 = mem[''car''] > t2=Time.new > puts (t2.to_f - t1.to_f).to_s > > list3 = list1.split('':'') & list2.split('':'') > t3 = Time.new > puts (t3.to_f - t2.to_f).to_s > puts list3 > t4 = Time.new > puts (t4.to_f - t3.to_f).to_s > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Well, the python-memcache was 50x faster, got it down to only 4x faster w/ memcache-client as suggested. Two other things I''ve noticed: 1) Python is much more stable - I very rarely get any kind of corruption or unexpected behavior - I''ve had to start over 5 times w/ ruby''s memcache. 2) Ruby seems to care much more about marshaling, etc. Python seems quite happy to let you leave things as strings and do your own parsing. Am I insane to consider trying to figure out how to use a python library in ruby? Is there such a thing? Or perhaps I should use a ReST API hosted by python, available from ruby - http://localhost:11212/search?key=''red'' (and in fact I''m only going to be GETing from ruby - doing all the bulk cache loading on the python side thanks very much). Any other suggestions? m On 9/14/07, Philip Hallstrom <rails-SUcgGwS4C16SUMMaM/qcSw@public.gmane.org> wrote:> > > > > On Fri, 14 Sep 2007, Marc Byrd wrote: > > > Case 1: Ruby + Ruby-MemCache + onboard memcache (the cache) - 10.5seconds > > > > Case 2: Python + REMOTE memcache (the same cache as the other) - > 0.2seconds > > > > Please please tell me I''m doing something very wrong... - and examples > of > > the right way would be great. > > Try memcache-client instead... > > http://dev.robotcoop.com/Libraries/memcache-client/index.html > > It''s supposed to be a lot faster... > > Also, if this is on a mac and you''re using memcache 1.2.0 recompile it and > tweak the following: > > # edit memcached.h and add ''#undef NO_TCPPUSH'' to the top > > Can''t remember where exactly I read that, but it makes a huge difference. > > > > > > m > > -- > > here''s my code: > > > > require ''memcache'' > > > > > > mem = MemCache.new ''10.253.9.158'' > > #mem = MemCache.new ''127.0.0.1'' > > > > t1=Time.new > > list1 = mem[''red''] > > list2 = mem[''car''] > > t2=Time.new > > puts (t2.to_f - t1.to_f).to_s > > > > list3 = list1.split('':'') & list2.split('':'') > > t3 = Time.new > > puts (t3.to_f - t2.to_f).to_s > > puts list3 > > t4 = Time.new > > puts (t4.to_f - t3.to_f).to_s > > > > > > > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---