Re: Persistent Data Structures for Objective-C/LLVM

2014-12-19 Thread Raju Bitter
Wow, that's incredible! Who would have thought that anything written in
ClojureScript - and running inside a JS engine - could ever be so much
faster than an Objective-C implementation!


On Thu, Nov 13, 2014 at 5:17 AM, Mike Fikes  wrote:

> I'm thinking Anton's persistent collections could be useful on iOS.
>
> Out of curiosity, I made a small iOS project that compares the performance
> of Anton's map to ClojureScript's, when adding lots of key-value pairs
> (using transients): https://github.com/mfikes/persistent-objc-cljs
>
> Interestingly, they both run at nearly the same speed on an iOS device.
> But, when running on a Mac, the ClojureScript is currently about a factor
> of 7 times faster than the Objective-C.
>
> --
> 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/d/optout.
>

-- 
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/d/optout.


Re: Persistent Data Structures for Objective-C/LLVM

2014-11-12 Thread Mike Fikes
I'm thinking Anton's persistent collections could be useful on iOS.

Out of curiosity, I made a small iOS project that compares the performance 
of Anton's map to ClojureScript's, when adding lots of key-value pairs 
(using transients): https://github.com/mfikes/persistent-objc-cljs

Interestingly, they both run at nearly the same speed on an iOS device. 
But, when running on a Mac, the ClojureScript is currently about a factor 
of 7 times faster than the Objective-C.

-- 
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/d/optout.


Re: Persistent Data Structures for Objective-C/LLVM

2014-11-12 Thread Anton Astashov
It is indeed waaay slower now than original 
NSArray/NSSet/NSDictionary (on large maps ~20x than NSMutableDictionary, on 
large vectors ~100x than NSMutableArray) but that's a tradeoff :).
I'll continue to work on speeding it up though.

On Wednesday, November 12, 2014 2:01:07 PM UTC-8, Anton Astashov wrote:
>
> All objects in Objective-C actually maintain their reference count. This 
> is how ARC works. So, if there is only one reference to a vector, and we 
> create a new modified vector with a new element, the changed nodes of the 
> old vector will set reference count to 0 and will be disposed.
>
> On Wednesday, November 12, 2014 12:36:36 PM UTC-8, Stephen Wakely wrote:
>>
>> Interesting. I would definitely look into this if I ever need to do 
>> another iOS app.
>>
>> How does it work in a language without garbage collection? If you replace 
>> an element in a vector and only keep a reference to the new vector there 
>> will be a stray element there that would need mopping up. Is ARC clever 
>> enough to recognise this? I wouldn't have thought so unless you maintain a 
>> reference count for every element within the vector.. Which I don't imagine 
>> would be particularly efficient. 
>>
>> On Wed, 12 Nov 2014 3:48 PM Anton Astashov  wrote:
>>
>>> Sorry for resurrecting of such an old post, but I just wrote port of 
>>> Clojure's data structures in Objective-C - 
>>> https://github.com/astashov/persistent.objc - hopefully one day someone 
>>> will find that useful. :)
>>>
>>> On Sunday, March 31, 2013 5:43:52 AM UTC-7, Matthias Benkard wrote:

 I implemented persistent, array-mapped Patricia trees in C a while ago:

 https://matthias.benkard.de/journal/118

 It should be relatively straight-forward to build some Objective-C 
 classes on top of that.  (There's a reason the memory management routines 
 are named bpt_{retain, release, dealloc}. :))

 You'll just need to do the hashing yourself if you want to build a hash 
 map.

 Matthias

>>>  -- 
>>> 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
>>> 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
>>> 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.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>

-- 
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/d/optout.


Re: Persistent Data Structures for Objective-C/LLVM

2014-11-12 Thread Anton Astashov
All objects in Objective-C actually maintain their reference count. This is 
how ARC works. So, if there is only one reference to a vector, and we 
create a new modified vector with a new element, the changed nodes of the 
old vector will set reference count to 0 and will be disposed.

On Wednesday, November 12, 2014 12:36:36 PM UTC-8, Stephen Wakely wrote:
>
> Interesting. I would definitely look into this if I ever need to do 
> another iOS app.
>
> How does it work in a language without garbage collection? If you replace 
> an element in a vector and only keep a reference to the new vector there 
> will be a stray element there that would need mopping up. Is ARC clever 
> enough to recognise this? I wouldn't have thought so unless you maintain a 
> reference count for every element within the vector.. Which I don't imagine 
> would be particularly efficient. 
>
> On Wed, 12 Nov 2014 3:48 PM Anton Astashov  > wrote:
>
>> Sorry for resurrecting of such an old post, but I just wrote port of 
>> Clojure's data structures in Objective-C - 
>> https://github.com/astashov/persistent.objc - hopefully one day someone 
>> will find that useful. :)
>>
>> On Sunday, March 31, 2013 5:43:52 AM UTC-7, Matthias Benkard wrote:
>>>
>>> I implemented persistent, array-mapped Patricia trees in C a while ago:
>>>
>>> https://matthias.benkard.de/journal/118
>>>
>>> It should be relatively straight-forward to build some Objective-C 
>>> classes on top of that.  (There's a reason the memory management routines 
>>> are named bpt_{retain, release, dealloc}. :))
>>>
>>> You'll just need to do the hashing yourself if you want to build a hash 
>>> map.
>>>
>>> Matthias
>>>
>>  -- 
>> 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 
>> 
>> 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 
>> 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 .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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/d/optout.


Re: Persistent Data Structures for Objective-C/LLVM

2014-11-12 Thread Stephen Wakely
Interesting. I would definitely look into this if I ever need to do another
iOS app.

How does it work in a language without garbage collection? If you replace
an element in a vector and only keep a reference to the new vector there
will be a stray element there that would need mopping up. Is ARC clever
enough to recognise this? I wouldn't have thought so unless you maintain a
reference count for every element within the vector.. Which I don't imagine
would be particularly efficient.

On Wed, 12 Nov 2014 3:48 PM Anton Astashov  wrote:

> Sorry for resurrecting of such an old post, but I just wrote port of
> Clojure's data structures in Objective-C -
> https://github.com/astashov/persistent.objc - hopefully one day someone
> will find that useful. :)
>
> On Sunday, March 31, 2013 5:43:52 AM UTC-7, Matthias Benkard wrote:
>>
>> I implemented persistent, array-mapped Patricia trees in C a while ago:
>>
>> https://matthias.benkard.de/journal/118
>>
>> It should be relatively straight-forward to build some Objective-C
>> classes on top of that.  (There's a reason the memory management routines
>> are named bpt_{retain, release, dealloc}. :))
>>
>> You'll just need to do the hashing yourself if you want to build a hash
>> map.
>>
>> Matthias
>>
>  --
> 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/d/optout.
>

-- 
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/d/optout.


Re: Persistent Data Structures for Objective-C/LLVM

2014-11-12 Thread Anton Astashov
Sorry for resurrecting of such an old post, but I just wrote port of 
Clojure's data structures in Objective-C 
- https://github.com/astashov/persistent.objc - hopefully one day someone 
will find that useful. :)

On Sunday, March 31, 2013 5:43:52 AM UTC-7, Matthias Benkard wrote:
>
> I implemented persistent, array-mapped Patricia trees in C a while ago:
>
> https://matthias.benkard.de/journal/118
>
> It should be relatively straight-forward to build some Objective-C classes 
> on top of that.  (There's a reason the memory management routines are named 
> bpt_{retain, release, dealloc}. :))
>
> You'll just need to do the hashing yourself if you want to build a hash 
> map.
>
> Matthias
>

-- 
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/d/optout.


Re: Persistent Data Structures for Objective-C/LLVM

2013-03-31 Thread Matthias Benkard
I implemented persistent, array-mapped Patricia trees in C a while ago:

https://matthias.benkard.de/journal/118

It should be relatively straight-forward to build some Objective-C classes 
on top of that.  (There's a reason the memory management routines are named 
bpt_{retain, release, dealloc}. :))

You'll just need to do the hashing yourself if you want to build a hash map.

Matthias

-- 
-- 
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: Persistent Data Structures for Objective-C/LLVM

2013-03-28 Thread David Nolen
As far as I know the immutable Objective-C collections are not efficient to
update and likely perform terrible in this respect to Clojure collections.


On Thu, Mar 28, 2013 at 1:07 PM, Omer Iqbal  wrote:

> Most foundation objective c data structures are immutable (NSArray,
> NSDictionary, NSSet etc), and are most probably more performant than
> clojure counterparts, though terribly less elegant.
> However there's the clojure-scheme project (
> https://github.com/takeoutweight/clojure-scheme)  which compiles clojure
> to gambit scheme which can be compiled to C.
>
>
> On Fri, Mar 29, 2013 at 12:53 AM, Krukow  wrote:
>
>> Hi,
>> Kind of an unusual question, but is anyone in this group aware of a c,
>> objective-c or LLVM-based implementation of the Clojure persistent data
>> structures?
>>
>> - Karl
>>
>> --
>> --
>> 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.
>
>
>

-- 
-- 
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: Persistent Data Structures for Objective-C/LLVM

2013-03-28 Thread Karl Krukow
On 28/03/2013, at 18.07, Omer Iqbal wrote:

> Most foundation objective c data structures are immutable (NSArray, 
> NSDictionary, NSSet etc), and are most probably more performant than clojure 
> counterparts, though terribly less elegant.
> However there's the clojure-scheme project 
> (https://github.com/takeoutweight/clojure-scheme)  which compiles clojure to 
> gambit scheme which can be compiled to C.

Thanks for your reply. However, I very much doubt that the objective c data 
structures use array-mapped hash tries which (I believe) is necessary for 
high-performance functional programming. Or am I wrong?

- Karl

-- 
-- 
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: Persistent Data Structures for Objective-C/LLVM

2013-03-28 Thread Omer Iqbal
Most foundation objective c data structures are immutable (NSArray,
NSDictionary, NSSet etc), and are most probably more performant than
clojure counterparts, though terribly less elegant.
However there's the clojure-scheme project (
https://github.com/takeoutweight/clojure-scheme)  which compiles clojure to
gambit scheme which can be compiled to C.


On Fri, Mar 29, 2013 at 12:53 AM, Krukow  wrote:

> Hi,
> Kind of an unusual question, but is anyone in this group aware of a c,
> objective-c or LLVM-based implementation of the Clojure persistent data
> structures?
>
> - Karl
>
> --
> --
> 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.




Persistent Data Structures for Objective-C/LLVM

2013-03-28 Thread Krukow
Hi,
Kind of an unusual question, but is anyone in this group aware of a c, 
objective-c or LLVM-based implementation of the Clojure persistent data 
structures?

- Karl

-- 
-- 
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.