[gambit-list] Meroon

David St-Hilaire sthilaid at iro.umontreal.ca
Fri Mar 12 16:51:27 EST 2010


Wow, this sure is a great performance gain! It would be conveniant  
that a (not safe) declaration would automatically do this, but still  
this is a pretty convincing benchmark to use Meroon (as long as  
multiple hierarchy is not desired ^_-).

--
David

Le 2010-03-12 à 16:38, Bradley Lucier <lucier at math.purdue.edu> a  
écrit :

> This thread got me wondering whether "unsafe" Meroon accessors,  
> setters,
> etc., would be of interest to people.
>
> On the machine I'm sitting in front of, I get with the current Meroon
>
> (meroon-instance-creation .15108799934387207)
> (meroon-access .041027069091796875)
> (meroon-modif .04129195213317871)
> (meroon-dispatch-2 .5176689624786377)
> (meroon-dispatch-5 .9149508476257324)
> (meroon-polymorhpic-dispatch-2 .5540168285369873)
> (meroon-polymorhpic-dispatch-5 1.0130860805511475)
>
> If I define a new file _meroon#.scm that contains everything needed  
> for
> check-class and include it in the benchmark file, I get
>
> (meroon-instance-creation .16762185096740723)
> (meroon-access .012614011764526367)
> (meroon-modif .011465072631835938)
> (meroon-dispatch-2 .48472118377685547)
> (meroon-dispatch-5 1.0633580684661865)
> (meroon-polymorhpic-dispatch-2 .4715709686279297)
> (meroon-polymorhpic-dispatch-5 1.0170669555664062)
>
> So, it's a bit over three times as fast.
>
> But if I rewrite the getter/setter/... code to allow the user to  
> define
> a macro
>
> (define-macro (meroon-safe-fields?) #f)
>
> that eliminates the runtime checks I get
>
> (meroon-instance-creation .16996002197265625)
> (meroon-access .002710103988647461)
> (meroon-modif .0028591156005859375)
> (meroon-dispatch-2 .5442471504211426)
> (meroon-dispatch-5 .9221928119659424)
> (meroon-polymorhpic-dispatch-2 .49954700469970703)
> (meroon-polymorhpic-dispatch-5 .9451491832733154)
>
> and with define-type I get
>
> (define-type-instance-creation .0019330978393554688)
> (define-type-access .003993988037109375)
> (define-type-modif .002807140350341797)
> (define-type-dispatch-2 .047636985778808594)
> (define-type-dispatch-5 .13761401176452637)
> (define-type-polymorhpic-dispatch-2 .06707501411437988)
> (define-type-polymorhpic-dispatch-5 .17751502990722656)
>
> So accessing and modifying is about as fast as with define-type;
> instance-creation is more, but that's because instance creation calls
> the intialize! generic on the created instance, and I don't want to  
> give
> that up.  (After all, Meroon should offer *something* beyond define- 
> type
> structures.)
>
> So, what do you think? The macro definition
>
> (define-macro (meroon-safe-fields?) #f)
>
> would apply to the current file, meaning something like
>
> (declare (not meroon-safe-fields))
>
> Is it so important to have fast unsafe access and modification
> functions?
>
> Brad



More information about the Gambit-list mailing list