Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Performance difference between struct and CLOS?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  Messages 1 - 25 of 32 - Collapse all  -  Translate all to Translated (View all originals)   Newer >
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
J Kenneth King  
View profile  
 More options Jan 9 2009, 4:45 pm
Newsgroups: comp.lang.lisp
From: J Kenneth King <ja...@agentultra.com>
Date: Fri, 09 Jan 2009 16:45:32 -0500
Local: Fri, Jan 9 2009 4:45 pm
Subject: Performance difference between struct and CLOS?

I'm stilly rather new to Lisp, so please bear with me. I've read through
most of PCL by now, have been attending my local meetups, and lurking on
c.l.l... I'd appreciate a little help filling in the gaps.

Basically, for my first non-trivial project, I'm working on a Lisp
implementation of the SIFT feature detector by David Lowe. I'm borrowing
a lot of ideas from the C imlementation by Rob Hess.

I'm still pretty early in the project and was curious if there would be
any performance gains by using structs as the fundamental data type for
storing descriptors over CLOS objects. In the end, this is going to need
every ounce of performance I can get.

Cheers and happy hacking. :)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Moritz U.  
View profile  
 More options Jan 9 2009, 4:56 pm
Newsgroups: comp.lang.lisp
From: "Moritz U." <ulrich.mor...@googlemail.com>
Date: Fri, 9 Jan 2009 13:56:55 -0800 (PST)
Local: Fri, Jan 9 2009 4:56 pm
Subject: Re: Performance difference between struct and CLOS?
On Jan 9, 10:45 pm, J Kenneth King <ja...@agentultra.com> wrote:

> I'm stilly rather new to Lisp, so please bear with me. I've read through
> most of PCL by now, have been attending my local meetups, and lurking on
> c.l.l... I'd appreciate a little help filling in the gaps.

> Basically, for my first non-trivial project, I'm working on a Lisp
> implementation of the SIFT feature detector by David Lowe. I'm borrowing
> a lot of ideas from the C imlementation by Rob Hess.

> I'm still pretty early in the project and was curious if there would be
> any performance gains by using structs as the fundamental data type for
> storing descriptors over CLOS objects. In the end, this is going to need
> every ounce of performance I can get.

> Cheers and happy hacking. :)

Premature optimation is the source of all evil.
You can surely ignore this question at the moment and use the better
fitting one.
If this is *really* the bottleneck in the end you can change it then.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dimiter malkia Stanev  
View profile  
 More options Jan 9 2009, 3:40 am
Newsgroups: comp.lang.lisp
From: "Dimiter \"malkia\" Stanev" <mal...@mac.com>
Date: Fri, 09 Jan 2009 00:40:44 -0800
Local: Fri, Jan 9 2009 3:40 am
Subject: Re: Performance difference between struct and CLOS?

It's also the source of a good framerate in a game :)

That to be said - a lot of game code is prematurely optimized for the
sake of speed - right there starting from your data structures. You
won't be able to make Spiderman-2 swinging around the city and loading
asynchronously prebaked data (it load it's in such way that even the C++
classes are prebaked, you only need to patch the pointers).

I mean it was "prematurely" optimized from the start to be like that,
instead of loading buts & nolts of random files scattered around, thus
reducing seek/load times on an old max 2-4mb/s CD/DVD player that the
PS2 had.

Same goes for other streaming games - like Grand Theft Auto, etc.

Then again - you had the Naughty Dog guys with their streaming game done
in Lisp too! So I dunno :)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
J Kenneth King  
View profile  
 More options Jan 9 2009, 5:33 pm
Newsgroups: comp.lang.lisp
From: J Kenneth King <ja...@agentultra.com>
Date: Fri, 09 Jan 2009 17:33:21 -0500
Local: Fri, Jan 9 2009 5:33 pm
Subject: Re: Performance difference between struct and CLOS?

Well the accessor semantics are a little different between CLOS and
defstruct-generated objects, no? I suppose if I started with structs it
would be fairly easy to map CLOS slot accessors to the ones normally
generated by defstruct; the other way around might not be as easy.

I understand the optimization rule of thumb, but I don't think it
applies to the question I'm asking. I'm not talking about how to
optimize program structure or make a loop faster before I'm even
finished writing the program. I'm simply asking what bricks I should
start building my house with in the first place.

SIFT feature detection is used in object recognition. That means
programs written using this library will need to generate hundreds or
even thousands of these objects and do a lot of numerical calculations
on their values (kd-tree or kd-means searches, etc).

Granted, I'm just going with structs for now but I'm just curious.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
joswig@corporate-world.li sp.de  
View profile  
 More options Jan 9 2009, 6:09 pm
Newsgroups: comp.lang.lisp
From: "jos...@corporate-world.lisp.de" <jos...@corporate-world.lisp.de>
Date: Fri, 9 Jan 2009 15:09:55 -0800 (PST)
Local: Fri, Jan 9 2009 6:09 pm
Subject: Re: Performance difference between struct and CLOS?
On 9 Jan., 23:33, J Kenneth King <ja...@agentultra.com> wrote:

A usual strategy is to hide the class/structure decision behind a
macro.
There are reasons I can see for that: a) experimentation with
the alternatives, b) support for special Common Lisp implementations
that don't have CLOS (or structures) and c) switching to the
faster method during delivery (and the more flexible method during
development).

For an example see DEF-CLX-CLASS :  http://common-lisp.net/~crhodes/clx/depdefs.lisp

CLOS slot access can be slower. You should be able to find out
if it matters to you in your application with a small benchmark.
Some implementations can speed up slot access. You might
want to ask the 'vendor' - if you are happy with implementation
specific CLOS extensions. For example IIRC Clozure CL has/had
primary classes, where slot layout is fixed.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Thomas A. Russ  
View profile  
 More options Jan 9 2009, 6:33 pm
Newsgroups: comp.lang.lisp
From: t...@sevak.isi.edu (Thomas A. Russ)
Date: 09 Jan 2009 15:33:13 -0800
Local: Fri, Jan 9 2009 6:33 pm
Subject: Re: Performance difference between struct and CLOS?
J Kenneth King <ja...@agentultra.com> writes:

> I'm still pretty early in the project and was curious if there would be
> any performance gains by using structs as the fundamental data type for
> storing descriptors over CLOS objects. In the end, this is going to need
> every ounce of performance I can get.

Generally you will get a performance boost by using structs versus clos
objects.  The real question is whether you need any of the more advanced
structuring features of CLOS (such as multiple inheritance).

Structs give you a single line of inheritance through structure
inclusion.  As long as that doesn't cause you problems, you can use
structs and gain an element of speed.

CLOS methods can be dispatched based on the type of your structs (as
long as you don't specify LIST or VECTOR structs), but you would want to
use generic functions sparingly, since they do have a bit more overhead
than non-generic function calls -- although many lisp implementations
can do a very good job of optimizing them.  Allegro does well in that
department.

You also need to perhaps think carefully about which Lisp implementation
you plan to use.  They also have different strengths and weaknesses with
respect to performance.  SBCL/CMUCL do particularly well with floating
point numeric computations.  CLISP has very fast bignum processing, but
other areas are a bit slow.  ACL handles a number of other
optimizations, particularly CLOS quite well.  I don't have enough
experience with LispWorks to comment on their product.  That isn't meant
to exclude them.

--
Thomas A. Russ,  USC/Information Sciences Institute


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kenneth Tilton  
View profile  
 More options Jan 9 2009, 11:20 pm
Newsgroups: comp.lang.lisp
From: Kenneth Tilton <kentil...@gmail.com>
Date: Fri, 09 Jan 2009 23:20:40 -0500
Local: Fri, Jan 9 2009 11:20 pm
Subject: Re: Performance difference between struct and CLOS?

It is not premature if the OP is right about "this is going to need
every ounce of performance I can get". Sure, folks often guess worng on
that, but if you want to beat Deep Blue, you better not be using CLOS.

More importantly, it is not optimization if structs work perfectly well
for the application. Optimization is defined to be writing crappy
brittle code where elegant code is too slow.

btw, structs "work perfectly well" even if here and there something CLOS
offers is needed, because those things can be had other ways with
sufficient additional code and without becoming as slow as a CLOS-based
solution.

my2.kth


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rob Warnock  
View profile  
 More options Jan 10 2009, 6:06 am
Newsgroups: comp.lang.lisp
From: r...@rpw3.org (Rob Warnock)
Date: Sat, 10 Jan 2009 05:06:01 -0600
Local: Sat, Jan 10 2009 6:06 am
Subject: Re: Performance difference between struct and CLOS?
Kenneth Tilton  <kentil...@gmail.com> wrote:
+---------------
| btw, structs "work perfectly well" even if here and there something CLOS
| offers is needed, because those things can be had other ways with
| sufficient additional code and without becoming as slow as a CLOS-based
| solution.
+---------------

Specifically, specialized methods "work perfectly well" on structs.
And since structs provide "single inheritance" via the :INCLUDE option,
DEFSTRUCT + DEFMETHOD gives you most of what non-Lispers think of as
an OO system.

It's probably worth noting that CL allows a struct to be defined
with zero slots, which can come in handy when wanting to change the
behavior of just a few methods of an :INCLUDE'd struct. [I found
myself making use of that when working on a compiler graph problem
where the parent NODE struct already had all the common data that
was needed, other than a unique dispatchable node type.]

-Rob

-----
Rob Warnock                     <r...@rpw3.org>
627 26th Avenue                 <URL:http://rpw3.org/>
San Mateo, CA 94403             (650)572-2607


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
D Herring  
View profile  
 More options Jan 10 2009, 10:07 am
Newsgroups: comp.lang.lisp
From: D Herring <dherr...@at.tentpost.dot.com>
Date: Sat, 10 Jan 2009 10:07:29 -0500
Local: Sat, Jan 10 2009 10:07 am
Subject: Re: Performance difference between struct and CLOS?

J Kenneth King wrote:
> Basically, for my first non-trivial project, I'm working on a Lisp
> implementation of the SIFT feature detector by David Lowe. I'm borrowing
> a lot of ideas from the C imlementation by Rob Hess.

> I'm still pretty early in the project and was curious if there would be
> any performance gains by using structs as the fundamental data type for
> storing descriptors over CLOS objects. In the end, this is going to need
> every ounce of performance I can get.

Yes, structs are generally faster than CLOS objects; their restricted
abilities make them easier for the compiler to optimize.

What are you using for the graphics libraries?

- Daniel


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Pascal Costanza  
View profile  
 More options Jan 10 2009, 10:51 am
Newsgroups: comp.lang.lisp
From: Pascal Costanza <p...@p-cos.net>
Date: Sat, 10 Jan 2009 16:51:35 +0100
Local: Sat, Jan 10 2009 10:51 am
Subject: Re: Performance difference between struct and CLOS?

J Kenneth King wrote:
> I'm stilly rather new to Lisp, so please bear with me. I've read through
> most of PCL by now, have been attending my local meetups, and lurking on
> c.l.l... I'd appreciate a little help filling in the gaps.

> Basically, for my first non-trivial project, I'm working on a Lisp
> implementation of the SIFT feature detector by David Lowe. I'm borrowing
> a lot of ideas from the C imlementation by Rob Hess.

> I'm still pretty early in the project and was curious if there would be
> any performance gains by using structs as the fundamental data type for
> storing descriptors over CLOS objects. In the end, this is going to need
> every ounce of performance I can get.

Are these descriptors used a lot in the hot paths of the feature
detector? If yes, then choosing structs over classes may matter. If not,
then this choice won't matter at all.

You will only know by either understanding the algorithm well, or by
doing some good benchmarks, and probably only by doing both.

Pascal

--
My website: http://p-cos.net
Common Lisp Document Repository: http://cdr.eurolisp.org
Closer to MOP & ContextL: http://common-lisp.net/project/closer/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Scott Burson  
View profile  
 More options Jan 10 2009, 11:54 pm
Newsgroups: comp.lang.lisp
From: Scott Burson <FSet....@gmail.com>
Date: Sat, 10 Jan 2009 20:54:13 -0800 (PST)
Local: Sat, Jan 10 2009 11:54 pm
Subject: Re: Performance difference between struct and CLOS?
On Jan 9, 1:45 pm, J Kenneth King <ja...@agentultra.com> wrote:

> Basically, for my first non-trivial project, I'm working on a Lisp
> implementation of the SIFT feature detector by David Lowe. I'm borrowing
> a lot of ideas from the C imlementation by Rob Hess.

Not that I want to derail your admirable project of learning Lisp, but
is it possible your goals would be better served by foreign-calling
the existing C implementation?  Then you could focus on using Lisp for
whatever higher-level scene analysis you want to perform.

-- Scott


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kenneth Tilton  
View profile  
 More options Jan 11 2009, 2:14 am
Newsgroups: comp.lang.lisp
From: Kenneth Tilton <kentil...@gmail.com>
Date: Sun, 11 Jan 2009 02:14:55 -0500
Local: Sun, Jan 11 2009 2:14 am
Subject: Re: Performance difference between struct and CLOS?

Scott Burson wrote:
> On Jan 9, 1:45 pm, J Kenneth King <ja...@agentultra.com> wrote:
>> Basically, for my first non-trivial project, I'm working on a Lisp
>> implementation of the SIFT feature detector by David Lowe. I'm borrowing
>> a lot of ideas from the C imlementation by Rob Hess.

> Not that I want to derail your admirable project of learning Lisp, but
> is it possible your goals would be better served by foreign-calling
> the existing C implementation?  Then you could focus on using Lisp for
> whatever higher-level scene analysis you want to perform.

But now we are getting perilously close to application development, and
if you have been paying attention the OP wants to be a Lisper. This is
lisp's fatal flaw: it makes programming so much fun we do not care if
our program's do not do anything. His Frogginess the Miserable cannot
understand why we are not counting applications delivered, only because
he has never used an enjoyable language.

The guy who invented the truck is out there delivering boxes, the guy
who invented the snowboard is digging his ass out from under an
avalanche somewhere laughing his ass off. Something like that.

kth


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bakul Shah  
View profile  
 More options Jan 11 2009, 3:45 am
Newsgroups: comp.lang.lisp
From: Bakul Shah <bakul+use...@bitblocks.com>
Date: Sun, 11 Jan 2009 00:45:03 -0800
Local: Sun, Jan 11 2009 3:45 am
Subject: Re: Performance difference between struct and CLOS?

The guy who invented the motor truck died in 1900 (Mack trucks came
later). He also created the first motorcycle, the first taxi, the
first airship, the first motor driven boat, the first car that was
not an adaptation of a horse drawn carriage etc. The car company he
started has evolved into the largest truck and 13th largest car
manufacturer in the world and still bears his name. And I bet he
had a lot of fun along the way and a deep satisfaction!

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kenneth Tilton  
View profile  
 More options Jan 11 2009, 6:50 am
Newsgroups: comp.lang.lisp
From: Kenneth Tilton <kentil...@gmail.com>
Date: Sun, 11 Jan 2009 06:50:38 -0500
Local: Sun, Jan 11 2009 6:50 am
Subject: Re: Performance difference between struct and CLOS?

You must be a lot of fun at funerals.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
D Herring  
View profile  
 More options Jan 11 2009, 11:47 am
Newsgroups: comp.lang.lisp
From: D Herring <dherr...@at.tentpost.dot.com>
Date: Sun, 11 Jan 2009 11:47:57 -0500
Local: Sun, Jan 11 2009 11:47 am
Subject: Re: Performance difference between struct and CLOS?

J Kenneth King wrote:
> I'm still pretty early in the project and was curious if there would be
> any performance gains by using structs as the fundamental data type for
> storing descriptors over CLOS objects. In the end, this is going to need
> every ounce of performance I can get.

There was a recent thread on sbcl-help titled "CLOS sealing declarations".

In summary, Nikodemus suggested reading
http://www.sbcl.org/manual/Slot-access.html#Slot-access
and wrote

- Daniel

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Juliusz Chroboczek  
View profile  
 More options Jan 11 2009, 12:02 pm
Newsgroups: comp.lang.lisp
From: Juliusz Chroboczek <j...@pps.jussieu.fr>
Date: Sun, 11 Jan 2009 18:02:03 +0100
Local: Sun, Jan 11 2009 12:02 pm
Subject: Re: Performance difference between struct and CLOS?

> I'm still pretty early in the project and was curious if there would be
> any performance gains by using structs as the fundamental data type for
> storing descriptors over CLOS objects. In the end, this is going to need
> every ounce of performance I can get.

Yes, in good Common Lisp implementations structs are somewhat faster than
standard objects.  The main reason being that structs cannot be redefined,
hence slot accessors can be inlined.

You probably already know that, but I'll remind you that you can use most
of the CLOS goodies with structs -- for example, your generic functions can
dispatch on structs just as they can dispatch on standard objects, and
you're welcome to use hairy method combinations with structs.  Hence,
you'll be fine with structs unless you need multiple inheritance,
change-class, or hair in shared-initialize and friends.

Note however that defining structs with defclass is not portable, so if you
later decide to switch between structs and standard objects, you'll need to
rewrite all of your struct-creating functions.

An alternative to using structs are the CMUCL and SBCL-specific
class-sealing declarations.

                                        Juliusz


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "CLISP bignum performance." by Waldek Hebisch
Waldek Hebisch  
View profile  
 More options Jan 11 2009, 12:49 pm
Newsgroups: comp.lang.lisp
From: Waldek Hebisch <hebi...@math.uni.wroc.pl>
Date: Sun, 11 Jan 2009 17:49:07 +0000 (UTC)
Local: Sun, Jan 11 2009 12:49 pm
Subject: CLISP bignum performance.
Thomas A. Russ <t...@sevak.isi.edu> wrote:

> You also need to perhaps think carefully about which Lisp implementation
> you plan to use.  They also have different strengths and weaknesses with
> respect to performance.  SBCL/CMUCL do particularly well with floating
> point numeric computations.  CLISP has very fast bignum processing, but
> other areas are a bit slow.  ACL handles a number of other
> optimizations, particularly CLOS quite well.  I don't have enough
> experience with LispWorks to comment on their product.  That isn't meant
> to exclude them.

Frase "CLISP has very fast bignum processing" is frequently repeated,
but AFAICS is not entirely correct.  I use several Lisp implementations
for bignum intensive computations and for me CLISP consistently
is the slowest one (on my machine Closure CL had slower bignums, but
when I reported this to Closure CL developers they improved it
so that now it is faster than CLISP).

To illustrate this I did a little benchmark performs 10000 multiplies
and additions of numbers having about 1000 digits.  All on
2.4GHz Core 2 Duo (using 64-bit Lisp):

sbcl 0.104s
clisp 0.297694 s
gcl 0.09s
Clozure CL 0.284s

IIRC ECL was slightly slower than both sbcl and gcl (but pretty
close).

I also tried larger numbers, here GMP based bignums (gcl and ECL)
clearly win, with gcl beeing sligtly faster than ECL.

Of course, results may strongly depend on machine, some
implementations contain 32-bit only optimized code and use
slower generic code otherwise, machine architecture makes
difference too.

--
                              Waldek Hebisch
hebi...@math.uni.wroc.pl


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "Performance difference between struct and CLOS?" by J Kenneth King
J Kenneth King  
View profile  
 More options Jan 12 2009, 11:04 am
Newsgroups: comp.lang.lisp
From: J Kenneth King <ja...@agentultra.com>
Date: Mon, 12 Jan 2009 11:04:27 -0500
Local: Mon, Jan 12 2009 11:04 am
Subject: Re: Performance difference between struct and CLOS?

I'm using a bit of wishful thinking for that at the moment.

From browsing cliki/common-lisp it looks like I'll have to use an FFI to
ImageMagick (yech!). If it's somewhat trivial enough to generate FFI
bindings, I might be interested to use OpenCV at the least. I was almost
tempted to leap down the rabbit hole and go for a pure-Lisp graphics
library but I'll leave that one for another rainy day.

Of course, suggestions are welcome. :)

Cheers.

(and thanks for all of the helpful replies!)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "CLISP bignum performance." by George Neuner
George Neuner  
View profile  
 More options Jan 12 2009, 12:42 pm
Newsgroups: comp.lang.lisp
From: George Neuner <gneun...@comcast.net>
Date: Mon, 12 Jan 2009 12:42:51 -0500
Local: Mon, Jan 12 2009 12:42 pm
Subject: Re: CLISP bignum performance.
On Sun, 11 Jan 2009 17:49:07 +0000 (UTC), Waldek Hebisch

Are you timing just the bignum arithmetic or the whole program?

CLisp *does* have fast bignums - it uses the GMP library.  But CLisp
is a bytecoded implementation and is not as fast as native compilers
for a lot of other processing.  It also interprets source by default
although it does compile a form being timed.  For example, if you time
a loop that calls a function, the loop will be compiled but the
function may still be interpreted.

Be sure to compile all the forms in your program and try to time only
the arithmetic and not the reading/printing of numbers (if you do
print).  And don't do anything tricky - CLisp's compiler rewards
straightforward coding.  I think you'll get different results.

George


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "Performance difference between struct and CLOS?" by D Herring
D Herring  
View profile  
 More options Jan 12 2009, 8:37 pm
Newsgroups: comp.lang.lisp
From: D Herring <dherr...@at.tentpost.dot.com>
Date: Mon, 12 Jan 2009 20:37:38 -0500
Local: Mon, Jan 12 2009 8:37 pm
Subject: Re: Performance difference between struct and CLOS?

Take a look at ch-image; its a common API for cl-jpeg, retrospectiff,
zpng, ...  which are pure-lisp libs for jpeg, tiff, and png files.

- Daniel


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
GP lisper  
View profile  
 More options Jan 13 2009, 1:49 am
Newsgroups: comp.lang.lisp
From: GP lisper <spamb...@CloudDancer.com>
Date: Mon, 12 Jan 2009 22:49:19 -0800
Local: Tues, Jan 13 2009 1:49 am
Subject: Re: Performance difference between struct and CLOS?

On Fri, 09 Jan 2009 17:33:21 -0500, <ja...@agentultra.com> wrote:
> "Moritz U." <ulrich.mor...@googlemail.com> writes:
>> On Jan 9, 10:45 pm, J Kenneth King <ja...@agentultra.com> wrote:

>>> I'm still pretty early in the project and was curious if there would be
>>> any performance gains by using structs as the fundamental data type for
>>> storing descriptors over CLOS objects. In the end, this is going to need
>>> every ounce of performance I can get.

>> Premature optimation is the source of all evil.

> I suppose if I started with structs it
> would be fairly easy to map CLOS slot accessors to the ones normally
> generated by defstruct; the other way around might not be as easy.

That answers the question then.

--
"Most programmers use this on-line documentation nearly all of the
time, and thereby avoid the need to handle bulky manuals and perform
the translation from barbarous tongues."  CMU CL User Manual


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Steven M. Haflich  
View profile  
 More options Jan 14 2009, 10:13 pm
Newsgroups: comp.lang.lisp
From: "Steven M. Haflich" <s...@alum.mit.edu>
Date: Wed, 14 Jan 2009 19:13:43 -0800
Local: Wed, Jan 14 2009 10:13 pm
Subject: Re: Performance difference between struct and CLOS?

Moritz U. wrote:
> Premature optimation is the source of all evil.

Preposterous!  There are innumerable other sources of evil,
and this observation doesn't depend on any idiosyncratic personal
definition of evil.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Pascal J. Bourguignon  
View profile  
 More options Jan 15 2009, 4:19 am
Newsgroups: comp.lang.lisp
From: p...@informatimago.com (Pascal J. Bourguignon)
Date: Thu, 15 Jan 2009 10:19:45 +0100
Local: Thurs, Jan 15 2009 4:19 am
Subject: Re: Performance difference between struct and CLOS?
"Steven M. Haflich" <s...@alum.mit.edu> writes:

> Moritz U. wrote:
>> Premature optimation is the source of all evil.

> Preposterous!  There are innumerable other sources of evil,
> and this observation doesn't depend on any idiosyncratic personal
> definition of evil.

Sources of all evil are obviously multiple.

--
__Pascal Bourguignon__


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Paul Wallich  
View profile  
 More options Jan 15 2009, 9:13 am
Newsgroups: comp.lang.lisp
From: Paul Wallich <p...@panix.com>
Date: Thu, 15 Jan 2009 09:13:18 -0500
Local: Thurs, Jan 15 2009 9:13 am
Subject: Re: Performance difference between struct and CLOS?

Pascal J. Bourguignon wrote:
> "Steven M. Haflich" <s...@alum.mit.edu> writes:

>> Moritz U. wrote:
>>> Premature optimation is the source of all evil.
>> Preposterous!  There are innumerable other sources of evil,
>> and this observation doesn't depend on any idiosyncratic personal
>> definition of evil.

> Sources of all evil are obviously multiple.

So some sources of evil are Turing-complete?

paul   greenspun holds even in hell


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "CLISP bignum performance." by Waldek Hebisch
Waldek Hebisch  
View profile  
 More options Jan 15 2009, 2:23 pm
Newsgroups: comp.lang.lisp
From: Waldek Hebisch <hebi...@math.uni.wroc.pl>
Date: Thu, 15 Jan 2009 19:23:35 +0000 (UTC)
Local: Thurs, Jan 15 2009 2:23 pm
Subject: Re: CLISP bignum performance.

The timings I gave are a specific mini-bechmark (see end of the
message).

> CLisp *does* have fast bignums - it uses the GMP library.

I do not think CLISP uses GMP.  In the clisp sources I see another
bignum implementation (CLN) and no traces of GMP use.

> But CLisp
> is a bytecoded implementation and is not as fast as native compilers
> for a lot of other processing.  It also interprets source by default
> although it does compile a form being timed.  For example, if you time
> a loop that calls a function, the loop will be compiled but the
> function may still be interpreted.

> Be sure to compile all the forms in your program and try to time only
> the arithmetic and not the reading/printing of numbers (if you do
> print).  And don't do anything tricky - CLisp's compiler rewards
> straightforward coding.  I think you'll get different results.

The little benchmark I used (and gave timings that I posted) is below.
To make time easier to measure dot-product adds all products of elements
of two lists.  To avoid possiblity of trivial optimizations all numbers
are different, products are added, result is assigned to a variable.
I make sure that result is not printed, because printing is
usually quite time consuming and could change timing in undesired way.

(setf a (expt 9 1000))
(defun dot-product (l1 l2)
   (let ((s 0)
         (ll1 l1))
       (loop
           (cond
               ((null l2)
                   (return-from dot-product s))
               ((null ll1)
                   (setf ll1 l1)
                   (setf l2 (cdr l2)))
               (t
                   (setf s (+ s (* (car ll1) (car l2))))
                   (setf ll1 (cdr ll1)))))))

(compile 'dot-product)

(setf l1 nil)
(dotimes (i 100) (setf l1 (cons (- a i) l1)))
(setf l2 nil)
(dotimes (i 100) (setf l2 (cons (+ i a)  l2)))

(time (progn (setf ress (dot-product l1 l2)) nil))

--
                              Waldek Hebisch
hebi...@math.uni.wroc.pl


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Messages 1 - 25 of 32   Newer >
« Back to Discussions « Newer topic     Older topic »