Re: ANN: clj-tuple, efficient small collections

2013-08-30 Thread Zach Tellman
I've updated the library so tuples behave like vectors, rather than lists. 
 The macros have gotten kind of elephantine, but since I've already added 
every conceivable Clojure interface at least they won't get any bigger.  If 
there are any lingering gaps, though, please let me know.

Zach 

On Saturday, August 24, 2013 7:38:25 PM UTC-7, Zach Tellman wrote:

 I just pulled some code I wrote while trying to optimize 'memoize' into 
 its own library: https://github.com/ztellman/clj-tuple.  It only has the 
 one function, so I assume no one will need too much explanation.  However, 
 there may still be room for performance improvements, so if anyone wants to 
 take a stab, pull requests are welcome.

 Zach


-- 
-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: ANN: clj-tuple, efficient small collections

2013-08-26 Thread Kevin Downey
A Tuple protocol that defines get0 get1 get3 etc for fast element access
that doesn't tie you to using field names might be a good idea.

On 8/25/13 9:35 AM, Zach Tellman wrote:
 I don't think so, even the existence of all the Tuple* types are an 
 implementation detail, and you'd need to hint it as the right one to get 
 sane performance.  (nth t n) has good performance, you should prefer that.
 
 On Saturday, August 24, 2013 8:15:40 PM UTC-7, Ben wrote:

 Are the element names .e0, .e1 etc. considered part of the public 
 interface of tuple objects?


 On Sat, Aug 24, 2013 at 7:38 PM, Zach Tellman ztel...@gmail.comjavascript:
 wrote:

 I just pulled some code I wrote while trying to optimize 'memoize' into 
 its own library: https://github.com/ztellman/clj-tuple.  It only has the 
 one function, so I assume no one will need too much explanation.  However, 
 there may still be room for performance improvements, so if anyone wants to 
 take a stab, pull requests are welcome.

 Zach

 -- 
 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.comjavascript:
 Note that posts from new members are moderated - please be patient with 
 your first post.
 To unsubscribe from this group, send email to
 clojure+u...@googlegroups.com javascript:
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 --- 
 You received this message because you are subscribed to the Google Groups 
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+u...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/groups/opt_out.




 -- 
 Ben Wolfson
 Human kind has used its intelligence to vary the flavour of drinks, which 
 may be sweet, aromatic, fermented or spirit-based. ... Family and social 
 life also offer numerous other occasions to consume drinks for pleasure. 
 [Larousse, Drink entry]

  
 


-- 
And what is good, Phaedrus,
And what is not good—
Need we ask anyone to tell us these things?



signature.asc
Description: OpenPGP digital signature


Re: ANN: clj-tuple, efficient small collections

2013-08-26 Thread Asim Jalis
I believe this is what clj-tuple is doing under the hood with macros.

On Aug 26, 2013, at 10:38 AM, Kevin Downey redc...@gmail.com wrote:

 A Tuple protocol that defines get0 get1 get3 etc for fast element access
 that doesn't tie you to using field names might be a good idea.
 
 On 8/25/13 9:35 AM, Zach Tellman wrote:
 I don't think so, even the existence of all the Tuple* types are an 
 implementation detail, and you'd need to hint it as the right one to get 
 sane performance.  (nth t n) has good performance, you should prefer that.
 
 On Saturday, August 24, 2013 8:15:40 PM UTC-7, Ben wrote:
 
 Are the element names .e0, .e1 etc. considered part of the public 
 interface of tuple objects?
 
 
 On Sat, Aug 24, 2013 at 7:38 PM, Zach Tellman 
 ztel...@gmail.comjavascript:
 wrote:
 
 I just pulled some code I wrote while trying to optimize 'memoize' into 
 its own library: https://github.com/ztellman/clj-tuple.  It only has the 
 one function, so I assume no one will need too much explanation.  However, 
 there may still be room for performance improvements, so if anyone wants 
 to 
 take a stab, pull requests are welcome.
 
 Zach
 
 -- 
 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.comjavascript:
 Note that posts from new members are moderated - please be patient with 
 your first post.
 To unsubscribe from this group, send email to
 clojure+u...@googlegroups.com javascript:
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 --- 
 You received this message because you are subscribed to the Google Groups 
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+u...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/groups/opt_out.
 
 
 
 -- 
 Ben Wolfson
 Human kind has used its intelligence to vary the flavour of drinks, which 
 may be sweet, aromatic, fermented or spirit-based. ... Family and social 
 life also offer numerous other occasions to consume drinks for pleasure. 
 [Larousse, Drink entry]
 
 
 -- 
 And what is good, Phaedrus,
 And what is not good—
 Need we ask anyone to tell us these things?
 

-- 
-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: ANN: clj-tuple, efficient small collections

2013-08-26 Thread Jim - FooBar();

I had a quick look at clj-tuple and I don't remember seeing any macros...

Jim


On 26/08/13 19:02, Asim Jalis wrote:

I believe this is what clj-tuple is doing under the hood with macros.

On Aug 26, 2013, at 10:38 AM, Kevin Downey redc...@gmail.com wrote:


A Tuple protocol that defines get0 get1 get3 etc for fast element access
that doesn't tie you to using field names might be a good idea.

On 8/25/13 9:35 AM, Zach Tellman wrote:

I don't think so, even the existence of all the Tuple* types are an
implementation detail, and you'd need to hint it as the right one to get
sane performance.  (nth t n) has good performance, you should prefer that.

On Saturday, August 24, 2013 8:15:40 PM UTC-7, Ben wrote:

Are the element names .e0, .e1 etc. considered part of the public
interface of tuple objects?


On Sat, Aug 24, 2013 at 7:38 PM, Zach Tellman ztel...@gmail.comjavascript:

wrote:
I just pulled some code I wrote while trying to optimize 'memoize' into
its own library: https://github.com/ztellman/clj-tuple.  It only has the
one function, so I assume no one will need too much explanation.  However,
there may still be room for performance improvements, so if anyone wants to
take a stab, pull requests are welcome.

Zach

--
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clo...@googlegroups.comjavascript:
Note that posts from new members are moderated - please be patient with
your first post.
To unsubscribe from this group, send email to
clojure+u...@googlegroups.com javascript:
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an
email to clojure+u...@googlegroups.com javascript:.
For more options, visit https://groups.google.com/groups/opt_out.



--
Ben Wolfson
Human kind has used its intelligence to vary the flavour of drinks, which
may be sweet, aromatic, fermented or spirit-based. ... Family and social
life also offer numerous other occasions to consume drinks for pleasure.
[Larousse, Drink entry]


--
And what is good, Phaedrus,
And what is not good—
Need we ask anyone to tell us these things?



--
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups Clojure group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: ANN: clj-tuple, efficient small collections

2013-08-26 Thread Robert Levy
No, Asim is right, and the majority of LOC is macro code (which expands to
a deftype expression).


On Mon, Aug 26, 2013 at 11:51 AM, Jim - FooBar(); jimpil1...@gmail.comwrote:

 I had a quick look at clj-tuple and I don't remember seeing any macros...

 Jim



 On 26/08/13 19:02, Asim Jalis wrote:

 I believe this is what clj-tuple is doing under the hood with macros.

 On Aug 26, 2013, at 10:38 AM, Kevin Downey redc...@gmail.com wrote:

  A Tuple protocol that defines get0 get1 get3 etc for fast element access
 that doesn't tie you to using field names might be a good idea.

 On 8/25/13 9:35 AM, Zach Tellman wrote:

 I don't think so, even the existence of all the Tuple* types are an
 implementation detail, and you'd need to hint it as the right one to get
 sane performance.  (nth t n) has good performance, you should prefer
 that.

 On Saturday, August 24, 2013 8:15:40 PM UTC-7, Ben wrote:

 Are the element names .e0, .e1 etc. considered part of the public
 interface of tuple objects?


 On Sat, Aug 24, 2013 at 7:38 PM, Zach Tellman ztel...@gmail.com
 javascript:**

 wrote:
 I just pulled some code I wrote while trying to optimize 'memoize'
 into
 its own library: 
 https://github.com/ztellman/**clj-tuplehttps://github.com/ztellman/clj-tuple.
  It only has the
 one function, so I assume no one will need too much explanation.
  However,
 there may still be room for performance improvements, so if anyone
 wants to
 take a stab, pull requests are welcome.

 Zach

 --
 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.com**
 javascript:
 Note that posts from new members are moderated - please be patient
 with
 your first post.
 To unsubscribe from this group, send email to
 clojure+u...@googlegroups.com javascript:
 For more options, visit this group at
 http://groups.google.com/**group/clojure?hl=enhttp://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google
 Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it,
 send an
 email to clojure+u...@googlegroups.com javascript:.
 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .



 --
 Ben Wolfson
 Human kind has used its intelligence to vary the flavour of drinks,
 which
 may be sweet, aromatic, fermented or spirit-based. ... Family and
 social
 life also offer numerous other occasions to consume drinks for
 pleasure.
 [Larousse, Drink entry]


 --
 And what is good, Phaedrus,
 And what is not good—
 Need we ask anyone to tell us these things?


 --
 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/clojure?hl=enhttp://groups.google.com/group/clojure?hl=en
 --- You received this message because you are subscribed to the Google
 Groups Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to 
 clojure+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com
 .
 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .


-- 
-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: ANN: clj-tuple, efficient small collections

2013-08-26 Thread Zach Tellman
I'm not sure I understand the motivation behind what you're suggesting.
 Why not just (nth tuple 0)?


On Mon, Aug 26, 2013 at 10:38 AM, Kevin Downey redc...@gmail.com wrote:

 A Tuple protocol that defines get0 get1 get3 etc for fast element access
 that doesn't tie you to using field names might be a good idea.

 On 8/25/13 9:35 AM, Zach Tellman wrote:
  I don't think so, even the existence of all the Tuple* types are an
  implementation detail, and you'd need to hint it as the right one to get
  sane performance.  (nth t n) has good performance, you should prefer
 that.
 
  On Saturday, August 24, 2013 8:15:40 PM UTC-7, Ben wrote:
 
  Are the element names .e0, .e1 etc. considered part of the public
  interface of tuple objects?
 
 
  On Sat, Aug 24, 2013 at 7:38 PM, Zach Tellman ztel...@gmail.com
 javascript:
  wrote:
 
  I just pulled some code I wrote while trying to optimize 'memoize' into
  its own library: https://github.com/ztellman/clj-tuple.  It only has
 the
  one function, so I assume no one will need too much explanation.
  However,
  there may still be room for performance improvements, so if anyone
 wants to
  take a stab, pull requests are welcome.
 
  Zach
 
  --
  --
  You received this message because you are subscribed to the Google
  Groups Clojure group.
  To post to this group, send email to clo...@googlegroups.com
 javascript:
  Note that posts from new members are moderated - please be patient with
  your first post.
  To unsubscribe from this group, send email to
  clojure+u...@googlegroups.com javascript:
  For more options, visit this group at
  http://groups.google.com/group/clojure?hl=en
  ---
  You received this message because you are subscribed to the Google
 Groups
  Clojure group.
  To unsubscribe from this group and stop receiving emails from it, send
 an
  email to clojure+u...@googlegroups.com javascript:.
  For more options, visit https://groups.google.com/groups/opt_out.
 
 
 
 
  --
  Ben Wolfson
  Human kind has used its intelligence to vary the flavour of drinks,
 which
  may be sweet, aromatic, fermented or spirit-based. ... Family and social
  life also offer numerous other occasions to consume drinks for
 pleasure.
  [Larousse, Drink entry]
 
 
 


 --
 And what is good, Phaedrus,
 And what is not good—
 Need we ask anyone to tell us these things?



-- 
-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: ANN: clj-tuple, efficient small collections

2013-08-26 Thread Kevin Downey
looking at clj-tuple a call to (nth some-tuple 0) turns in to a case
dispatch

(case idx
  0 e0
  ...)

or something.

if you have a Tuple protocol with a function like get0 you can avoid the
overhead of the case there, and the jvm has a better change of inlining
the rest away.

for hotspot to optimize the case away is much more challenging (requires
the jit to track the index value, which it may actually do?) than
optimizing a method which is basically just a java getter (very common
code pattern the jvm sees all the time).

the last time I looked in to this was before criterium was available, so
I don't have proper jvm benchmarking for it, but I do believe a Tuple
protocol with something like get0 will be faster than (nth ... 0).

the down side of the get0 approach is you cannot destructuring that way.

On 8/26/13 11:02 AM, Asim Jalis wrote:
 I believe this is what clj-tuple is doing under the hood with macros.
 
 On Aug 26, 2013, at 10:38 AM, Kevin Downey redc...@gmail.com wrote:
 
 A Tuple protocol that defines get0 get1 get3 etc for fast element access
 that doesn't tie you to using field names might be a good idea.

 On 8/25/13 9:35 AM, Zach Tellman wrote:
 I don't think so, even the existence of all the Tuple* types are an 
 implementation detail, and you'd need to hint it as the right one to get 
 sane performance.  (nth t n) has good performance, you should prefer that.

 On Saturday, August 24, 2013 8:15:40 PM UTC-7, Ben wrote:

 Are the element names .e0, .e1 etc. considered part of the public 
 interface of tuple objects?


 On Sat, Aug 24, 2013 at 7:38 PM, Zach Tellman 
 ztel...@gmail.comjavascript:
 wrote:

 I just pulled some code I wrote while trying to optimize 'memoize' into 
 its own library: https://github.com/ztellman/clj-tuple.  It only has the 
 one function, so I assume no one will need too much explanation.  
 However, 
 there may still be room for performance improvements, so if anyone wants 
 to 
 take a stab, pull requests are welcome.

 Zach

 -- 
 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.comjavascript:
 Note that posts from new members are moderated - please be patient with 
 your first post.
 To unsubscribe from this group, send email to
 clojure+u...@googlegroups.com javascript:
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 --- 
 You received this message because you are subscribed to the Google Groups 
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+u...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/groups/opt_out.



 -- 
 Ben Wolfson
 Human kind has used its intelligence to vary the flavour of drinks, which 
 may be sweet, aromatic, fermented or spirit-based. ... Family and social 
 life also offer numerous other occasions to consume drinks for pleasure. 
 [Larousse, Drink entry]


 -- 
 And what is good, Phaedrus,
 And what is not good—
 Need we ask anyone to tell us these things?

 


-- 
And what is good, Phaedrus,
And what is not good—
Need we ask anyone to tell us these things?



signature.asc
Description: OpenPGP digital signature


Re: ANN: clj-tuple, efficient small collections

2013-08-25 Thread Jim - FooBar();

wow! very interesting stuff as always Zach...quick question:

I don't see Tuple implementing clojure.lang.Associative, so 'get' won't 
work right?


Jim

ps: I've got a project where I 'm working with a lot of 2-element 
vectors...I can't wait to try this out :)


On 25/08/13 03:38, Zach Tellman wrote:
I just pulled some code I wrote while trying to optimize 'memoize' 
into its own library: https://github.com/ztellman/clj-tuple.  It only 
has the one function, so I assume no one will need too much 
explanation.  However, there may still be room for performance 
improvements, so if anyone wants to take a stab, pull requests are 
welcome.


Zach
--
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient 
with your first post.

To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google 
Groups Clojure group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to clojure+unsubscr...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.


--
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups Clojure group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: ANN: clj-tuple, efficient small collections

2013-08-25 Thread Zach Tellman
I don't think so, even the existence of all the Tuple* types are an 
implementation detail, and you'd need to hint it as the right one to get 
sane performance.  (nth t n) has good performance, you should prefer that.

On Saturday, August 24, 2013 8:15:40 PM UTC-7, Ben wrote:

 Are the element names .e0, .e1 etc. considered part of the public 
 interface of tuple objects?


 On Sat, Aug 24, 2013 at 7:38 PM, Zach Tellman ztel...@gmail.comjavascript:
  wrote:

 I just pulled some code I wrote while trying to optimize 'memoize' into 
 its own library: https://github.com/ztellman/clj-tuple.  It only has the 
 one function, so I assume no one will need too much explanation.  However, 
 there may still be room for performance improvements, so if anyone wants to 
 take a stab, pull requests are welcome.

 Zach

 -- 
 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.comjavascript:
 Note that posts from new members are moderated - please be patient with 
 your first post.
 To unsubscribe from this group, send email to
 clojure+u...@googlegroups.com javascript:
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 --- 
 You received this message because you are subscribed to the Google Groups 
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+u...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/groups/opt_out.




 -- 
 Ben Wolfson
 Human kind has used its intelligence to vary the flavour of drinks, which 
 may be sweet, aromatic, fermented or spirit-based. ... Family and social 
 life also offer numerous other occasions to consume drinks for pleasure. 
 [Larousse, Drink entry]

  

-- 
-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: ANN: clj-tuple, efficient small collections

2013-08-25 Thread Zach Tellman
in my microbenchmarks I've found it to be consistently faster to unroll a 
fixed number of elements rather than iterate over them.  The difference 
might not be large enough to matter for many people's use cases, but the 
stated goal is to make a fast collection, so it's worthwhile to use the 
best known approach.

Currently tuples mimic lists, so conj adds onto the beginning, and does not 
return another tuple.  'rest', however, does return a tuple.  Also, since 
my intent wasn't to emulate vectors, 'get', 'assoc', and calling as 
function don't work with tuples.  This could obviously change, but I'd be 
curious to know why it makes a difference in someone's code.

Also, I played around with returning both a list or a vector in the 
unbounded case, but the performance is too different in each of these 
cases.  As I point out in the readme, vectors are *significantly* slower to 
create, which would make the performance of 'tuple' too inconsistent for my 
liking.  The TupleN solution I came up with was the best compromise I could 
think of.

Zach



On Saturday, August 24, 2013 10:47:11 PM UTC-7, Jozef Wagner wrote:

 Hi,

 I've did something similar for CLJS, see 
 http://dev.clojure.org/jira/browse/CLJS-453 and 
 https://groups.google.com/forum/#!searchin/clojure/arrayvector/clojure/yDvTRP0gYLA/Tb5MJC8Z0K8J

 In CLJS, it is comparable in performance to use array instead of 
 specialized type for each arity. Did you check if it is not the same in 
 Clojure?

 If I conjoin to the tuple, does it return a tuple too? Also instead of 
 tupleN, you could fall back to the PersistentVector.

 JW


 On Sun, Aug 25, 2013 at 4:38 AM, Zach Tellman ztel...@gmail.comjavascript:
  wrote:

 I just pulled some code I wrote while trying to optimize 'memoize' into 
 its own library: https://github.com/ztellman/clj-tuple.  It only has the 
 one function, so I assume no one will need too much explanation.  However, 
 there may still be room for performance improvements, so if anyone wants to 
 take a stab, pull requests are welcome.

 Zach

 -- 
 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.comjavascript:
 Note that posts from new members are moderated - please be patient with 
 your first post.
 To unsubscribe from this group, send email to
 clojure+u...@googlegroups.com javascript:
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 --- 
 You received this message because you are subscribed to the Google Groups 
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+u...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: ANN: clj-tuple, efficient small collections

2013-08-25 Thread Mikera
Good stuff Zach - I've certainly wanted something like this on various 
occasions. 

Some comments:
- core.matrix will also work with clj-tuple (because they support ISeq)
- If you made the tuples support IPersistentVector I think they would be 
even more useful: it's helpful I think to see tuples as specialised vectors
- vectorz-clj does something similar with specialised small types for 
primitive doubles (length 0 to 4) - recommended for small numerical vectors


On Sunday, 25 August 2013 10:38:25 UTC+8, Zach Tellman wrote:

 I just pulled some code I wrote while trying to optimize 'memoize' into 
 its own library: https://github.com/ztellman/clj-tuple.  It only has the 
 one function, so I assume no one will need too much explanation.  However, 
 there may still be room for performance improvements, so if anyone wants to 
 take a stab, pull requests are welcome.

 Zach


-- 
-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: ANN: clj-tuple, efficient small collections

2013-08-24 Thread Ben Wolfson
Are the element names .e0, .e1 etc. considered part of the public interface
of tuple objects?


On Sat, Aug 24, 2013 at 7:38 PM, Zach Tellman ztell...@gmail.com wrote:

 I just pulled some code I wrote while trying to optimize 'memoize' into
 its own library: https://github.com/ztellman/clj-tuple.  It only has the
 one function, so I assume no one will need too much explanation.  However,
 there may still be room for performance improvements, so if anyone wants to
 take a stab, pull requests are welcome.

 Zach

 --
 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
Ben Wolfson
Human kind has used its intelligence to vary the flavour of drinks, which
may be sweet, aromatic, fermented or spirit-based. ... Family and social
life also offer numerous other occasions to consume drinks for pleasure.
[Larousse, Drink entry]

-- 
-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: ANN: clj-tuple, efficient small collections

2013-08-24 Thread Jozef Wagner
Hi,

I've did something similar for CLJS, see
http://dev.clojure.org/jira/browse/CLJS-453 and
https://groups.google.com/forum/#!searchin/clojure/arrayvector/clojure/yDvTRP0gYLA/Tb5MJC8Z0K8J

In CLJS, it is comparable in performance to use array instead of
specialized type for each arity. Did you check if it is not the same in
Clojure?

If I conjoin to the tuple, does it return a tuple too? Also instead of
tupleN, you could fall back to the PersistentVector.

JW


On Sun, Aug 25, 2013 at 4:38 AM, Zach Tellman ztell...@gmail.com wrote:

 I just pulled some code I wrote while trying to optimize 'memoize' into
 its own library: https://github.com/ztellman/clj-tuple.  It only has the
 one function, so I assume no one will need too much explanation.  However,
 there may still be room for performance improvements, so if anyone wants to
 take a stab, pull requests are welcome.

 Zach

 --
 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.


-- 
-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.