Archive of RubyForge sup-devel mailing list
 help / color / mirror / Atom feed
From: Tero Tilus <tero@tilus.net>
To: Sup developers <sup-devel@rubyforge.org>
Subject: Re: [sup-devel] Scrolling (with patches)
Date: Fri, 31 Dec 2010 05:18:29 +0200	[thread overview]
Message-ID: <1293765315-sup-8280@tilus.net> (raw)
In-Reply-To: <1293759788-sup-1949@tilus.net>

[-- Attachment #1: Type: text/plain, Size: 253 bytes --]

Tero Tilus, 2010-12-31 03:44:
> From words to deeds.  ;)

...to first fix.  Private methods (at least Index.sync_message) are
being called on singletons and looks like they are expected to work.

-- 
Tero Tilus ## 050 3635 235 ## http://tero.tilus.net/

[-- Attachment #2: 0003-Improve-Singleton-performance.patch --]
[-- Type: application/octet-stream, Size: 984 bytes --]

From 9fd7a4f11709399219395320c9cdbf93c33f87fe Mon Sep 17 00:00:00 2001
From: Tero Tilus <tero@tilus.net>
Date: Fri, 31 Dec 2010 03:42:49 +0200
Subject: [PATCH] Improve Singleton performance

---
 lib/sup/util.rb |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/lib/sup/util.rb b/lib/sup/util.rb
index 3681180..f74ec6a 100644
--- a/lib/sup/util.rb
+++ b/lib/sup/util.rb
@@ -536,6 +536,14 @@ module Singleton
       ## special-case every call to a Singleton object
       return nil if @instance.nil?
 
+      # Speed up further calls by defining a shortcut around method_missing
+      if meth.to_s[-1,1] == '='
+        # Argh! Inconsistency! Setters do not work like all the other methods.
+        class_eval "def self.#{meth}(a); @instance.send :#{meth}, a; end"
+      else
+        class_eval "def self.#{meth}(*a, &b); @instance.send :#{meth}, *a, &b; end"
+      end
+
       @instance.send meth, *a, &b
     end
     def init *args
-- 
1.5.6.5


[-- Attachment #3: Type: text/plain, Size: 143 bytes --]

_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel

  reply	other threads:[~2010-12-31  3:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-30 23:35 Tero Tilus
2010-12-31  0:10 ` Rich Lane
2010-12-31  0:34   ` Tero Tilus
2010-12-31  1:44     ` Tero Tilus
2010-12-31  3:18       ` Tero Tilus [this message]
2011-01-19  3:15         ` Rich Lane
2011-01-19  3:13 ` Rich Lane

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1293765315-sup-8280@tilus.net \
    --to=tero@tilus.net \
    --cc=sup-devel@rubyforge.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox