Re: Do functions never get inlined by jvm?

2013-04-28 Thread Gary Verhaegen
[sorry for a premature send...]

I had the official documentation
(http://clojure.github.io/clojure/clojure.core-api.html) open in a
browser and was looking for things with plain search function of my
browser. I always found the docstrings to be very clear and to the
point.

But then, I did it the old-fashioned way : I began learning Clojure by
reading a book about it before writing any code, so I did have some
context from the start.

On 28 April 2013 11:07, Gary Verhaegen  wrote:
> I never understood why people complain about the documentation of
> clojure/core. From the very beginning, I have found the docstrings to
> be exactly what I needed; when I first began 4clojure, I had
>
> On 26 April 2013 01:30, u1204  wrote:
>> ...0? :-)
>>
>> Tim Daly
>>
>> --
>> --
>> 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: Do functions never get inlined by jvm?

2013-04-28 Thread Gary Verhaegen
I never understood why people complain about the documentation of
clojure/core. From the very beginning, I have found the docstrings to
be exactly what I needed; when I first began 4clojure, I had

On 26 April 2013 01:30, u1204  wrote:
> ...0? :-)
>
> Tim Daly
>
> --
> --
> 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: Do functions never get inlined by jvm?

2013-04-25 Thread u1204
...0? :-)

Tim Daly

-- 
-- 
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: Do functions never get inlined by jvm?

2013-04-25 Thread Softaddicts
I am not defending it at all cost. Just tired of earing you whining the same
complaint in around 70% of your posts and in some cases, like this one,
unrelated with the original issue.

Like if "correct" documentation could replace self acquired knowledge about how 
things
work. This is why civilisations decline, more people use technology but less and
less understand it. It's not just in Star Wars movies that this happens.

Do not generalize, Gretzky is Mr. Canada Nice Guy... were are not all like him
over here:)

Post whatever you want, I will now be mute, this thread is going nowhere.
Go get your diaper changed, the air is getting thick :)

Luc P.

> 2013/4/25 Softaddicts 
> 
> > May I suggest you an upgrade  ?
> >
> > http://www.ehow.com/how_6949396_record-78-vinyl-records-cd.html
> >
> 
> Ah, a batch of fresh preaching from Mr. Defend Clojure/core At All Costs.
> 
> Best Canadian export since Wayne Gretzky!
> -- 
> MK
> 
> http://github.com/michaelklishin
> http://twitter.com/michaelklishin
> 
> -- 
> -- 
> 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.
> 
> 
> 
--
Softaddicts sent by ibisMail from my ipad!

-- 
-- 
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: Do functions never get inlined by jvm?

2013-04-25 Thread gaz jones
There seems to be some rule that given sufficient time and enough
participants, all threads deteriorate into an argument about the current
state of clojure documentation and a huge post from Tim Daly regarding
literate programming in 3...2...1...


On Thu, Apr 25, 2013 at 2:23 PM, Gary Trakhman wrote:

> Good vinyls are considered higher quality by audiophiles, because there
> are less stages in between the mastering and amplification.  There is more
> potential of better performance.
>
> It can be considered a real-world case of inlining.
>
>
> On Thu, Apr 25, 2013 at 3:16 PM, Softaddicts 
> wrote:
>
>> May I suggest you an upgrade  ?
>>
>> http://www.ehow.com/how_6949396_record-78-vinyl-records-cd.html
>>
>> > 2013/4/25 Softaddicts 
>> >
>> > > Of course my answer comes in total antagonism with your usual position
>> > > about the
>> > > bad state of the existing documentation which is incomplete, wrong,
>> ...
>> > > and so forth.
>> > >
>> > Your reaction does not suprise me, your behavior is quite predictable.
>> > > Like an old vinyl record with all these scratches being played over
>> and
>> > > over
>> > > again.
>> > >
>> > >
>> > Nothing has changed w.r.t. Clojure/core's attitude towards documentation
>> > and making it easy
>> > for other people to contribute documentation improvements that are
>> rapidly
>> > integrated instead of
>> > gathering dust in JIRA for many months.
>> >
>> > Why would I suddenly start singing praises to something that is broken
>> and
>> > does not change?
>> >
>> > Sorry pal, someone has to periodically remind those in control of
>> Clojure
>> > that we are exactly
>> > where we were years ago. And that the entire community has to put up
>> with
>> > this.
>> >
>> >
>> > > Definline may be tagged as experimental but defrecord, defprotocol,
>> ...
>> > > are marked
>> > > as being in alpha stage. Does this prevents you from using them ?
>> > >
>> >
>> > Those are mentioned in every book and are widely used. It would be
>> crazy to
>> > break
>> > those by now. Makes a bit of difference when it comes to recommending
>> > features to people, don't you
>> > think?
>> > --
>> > MK
>> >
>> > http://github.com/michaelklishin
>> > http://twitter.com/michaelklishin
>> >
>> > --
>> > --
>> > 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.
>> >
>> >
>> >
>> --
>> Softaddicts sent by ibisMail from my ipad!
>>
>> --
>> --
>> 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
---

Re: Do functions never get inlined by jvm?

2013-04-25 Thread JeremyS

Hi guys,

Maybe we'll see some change in the future, Atlas 
already 
seems to be interesting. I think there is also a huge potential with Codeq. 
>From what I gather Codeq only
parse thing looking like (defsomething ) for now. But we can imagine that 
if we augment the capability of it, we could extract docstrings, symbols 
utilisation to 
connect the different parts of a code base, etc... I think there might be a 
Google Summer of Code project like that.

The cool things about Codeq are:

   -  it doesn't need anybody "in control" of Clojure to work on such a 
   project
   - we can add to the Codeq schema other documentation attributes than 
   docstrings to replace broken or insufficient documentation (still on our 
   own)
   - it surely as great potential to explain the code base of a project 
   with the fact that it can highlight evolution of the code at a higher level 
   than just git diffs
   - and it could be run on the core clojure libraries of course

And I don't think that I thought of all the things we could do about it but 
I think it might be the new way to generate documentation for code, a 
highly queryable one at that. 
The only issue, it's not done yet... :-D 

Cheers

-- 
-- 
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: Do functions never get inlined by jvm?

2013-04-25 Thread Michael Klishin
2013/4/25 Softaddicts 

> May I suggest you an upgrade  ?
>
> http://www.ehow.com/how_6949396_record-78-vinyl-records-cd.html
>

Ah, a batch of fresh preaching from Mr. Defend Clojure/core At All Costs.

Best Canadian export since Wayne Gretzky!
-- 
MK

http://github.com/michaelklishin
http://twitter.com/michaelklishin

-- 
-- 
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: Do functions never get inlined by jvm?

2013-04-25 Thread Gary Trakhman
Good vinyls are considered higher quality by audiophiles, because there are
less stages in between the mastering and amplification.  There is more
potential of better performance.

It can be considered a real-world case of inlining.


On Thu, Apr 25, 2013 at 3:16 PM, Softaddicts wrote:

> May I suggest you an upgrade  ?
>
> http://www.ehow.com/how_6949396_record-78-vinyl-records-cd.html
>
> > 2013/4/25 Softaddicts 
> >
> > > Of course my answer comes in total antagonism with your usual position
> > > about the
> > > bad state of the existing documentation which is incomplete, wrong, ...
> > > and so forth.
> > >
> > Your reaction does not suprise me, your behavior is quite predictable.
> > > Like an old vinyl record with all these scratches being played over and
> > > over
> > > again.
> > >
> > >
> > Nothing has changed w.r.t. Clojure/core's attitude towards documentation
> > and making it easy
> > for other people to contribute documentation improvements that are
> rapidly
> > integrated instead of
> > gathering dust in JIRA for many months.
> >
> > Why would I suddenly start singing praises to something that is broken
> and
> > does not change?
> >
> > Sorry pal, someone has to periodically remind those in control of Clojure
> > that we are exactly
> > where we were years ago. And that the entire community has to put up with
> > this.
> >
> >
> > > Definline may be tagged as experimental but defrecord, defprotocol, ...
> > > are marked
> > > as being in alpha stage. Does this prevents you from using them ?
> > >
> >
> > Those are mentioned in every book and are widely used. It would be crazy
> to
> > break
> > those by now. Makes a bit of difference when it comes to recommending
> > features to people, don't you
> > think?
> > --
> > MK
> >
> > http://github.com/michaelklishin
> > http://twitter.com/michaelklishin
> >
> > --
> > --
> > 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.
> >
> >
> >
> --
> Softaddicts sent by ibisMail from my ipad!
>
> --
> --
> 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: Do functions never get inlined by jvm?

2013-04-25 Thread Softaddicts
May I suggest you an upgrade  ?

http://www.ehow.com/how_6949396_record-78-vinyl-records-cd.html

> 2013/4/25 Softaddicts 
> 
> > Of course my answer comes in total antagonism with your usual position
> > about the
> > bad state of the existing documentation which is incomplete, wrong, ...
> > and so forth.
> >
> Your reaction does not suprise me, your behavior is quite predictable.
> > Like an old vinyl record with all these scratches being played over and
> > over
> > again.
> >
> >
> Nothing has changed w.r.t. Clojure/core's attitude towards documentation
> and making it easy
> for other people to contribute documentation improvements that are rapidly
> integrated instead of
> gathering dust in JIRA for many months.
> 
> Why would I suddenly start singing praises to something that is broken and
> does not change?
> 
> Sorry pal, someone has to periodically remind those in control of Clojure
> that we are exactly
> where we were years ago. And that the entire community has to put up with
> this.
> 
> 
> > Definline may be tagged as experimental but defrecord, defprotocol, ...
> > are marked
> > as being in alpha stage. Does this prevents you from using them ?
> >
> 
> Those are mentioned in every book and are widely used. It would be crazy to
> break
> those by now. Makes a bit of difference when it comes to recommending
> features to people, don't you
> think?
> -- 
> MK
> 
> http://github.com/michaelklishin
> http://twitter.com/michaelklishin
> 
> -- 
> -- 
> 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.
> 
> 
> 
--
Softaddicts sent by ibisMail from my ipad!

-- 
-- 
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: Do functions never get inlined by jvm?

2013-04-25 Thread Michael Klishin
2013/4/25 Softaddicts 

> Of course my answer comes in total antagonism with your usual position
> about the
> bad state of the existing documentation which is incomplete, wrong, ...
> and so forth.
>
Your reaction does not suprise me, your behavior is quite predictable.
> Like an old vinyl record with all these scratches being played over and
> over
> again.
>
>
Nothing has changed w.r.t. Clojure/core's attitude towards documentation
and making it easy
for other people to contribute documentation improvements that are rapidly
integrated instead of
gathering dust in JIRA for many months.

Why would I suddenly start singing praises to something that is broken and
does not change?

Sorry pal, someone has to periodically remind those in control of Clojure
that we are exactly
where we were years ago. And that the entire community has to put up with
this.


> Definline may be tagged as experimental but defrecord, defprotocol, ...
> are marked
> as being in alpha stage. Does this prevents you from using them ?
>

Those are mentioned in every book and are widely used. It would be crazy to
break
those by now. Makes a bit of difference when it comes to recommending
features to people, don't you
think?
-- 
MK

http://github.com/michaelklishin
http://twitter.com/michaelklishin

-- 
-- 
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: Do functions never get inlined by jvm?

2013-04-25 Thread Softaddicts
Well you looked quite outraged that it could not be found easily. I 
demonstrated 
that doc strings can be easily searched.

Of course my answer comes in total antagonism with your usual position about 
the 
bad state of the existing documentation which is incomplete, wrong, ... and so 
forth.

Your reaction does not suprise me, your behavior is quite predictable.
Like an old vinyl record with all these scratches being played over and over
again.

Definline may be tagged as experimental but defrecord, defprotocol, ... are 
marked
as being in alpha stage. Does this prevents you from using them ?

I hope so, especially in production.

Luc P.


> 2013/4/25 Softaddicts 
> 
> > Inlining is a concept that existed for more than 40 years in many
> > programming
> > languages. It's not anything new.
> >
> 
> The OP probably know what inlining is because, hm, the subject has that
> word.
> Then she is recommended to use something that only technically has
> documentation (and is marked as experimental) and is not known or used by
> many.
> 
> I've pointed that out. Problem?
> -- 
> MK
> 
> http://github.com/michaelklishin
> http://twitter.com/michaelklishin
> 
> -- 
> -- 
> 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.
> 
> 
> 
--
Softaddicts sent by ibisMail from my ipad!

-- 
-- 
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: Do functions never get inlined by jvm?

2013-04-25 Thread Gary Trakhman
You could come up with definline yourself by thinking about what inlining
is and wrapping things in macros, it seems to me the real problem definline
solves is to also be able to use the output as a function, which is more
about keeping convenience than performance gains.

I think the people who want to know about this stuff will find it, it took
me a couple hours myself when I worked through this thought process a year
or so ago.




On Thu, Apr 25, 2013 at 2:05 PM, Softaddicts wrote:

> You asked a simple question, you got a plain answer.
> Now if you are still grunting there's not much I can do about that.
>
> I do agree that the doc string could be a bit more descriptive.
> But what does it mean to be understandable by "normal" users ?
> I am still trying to size what is a "normal" Lisp user these days.
> No single answer seems to fit so far.
>
> When I first used Lisp, inlining meant writing pseudo assembly code
> right through your Lisp code most of the time using a macro.
> Procedural languages had most of the time
> extension directives to allow you to force inlining at your will.
>
> Inlining is a concept that existed for more than 40 years in many
> programming
> languages. It's not anything new. Now if you want to use it but do not
> understand the implications, well it's not the doc string that will explain
> it to you.
>
> To me, definline looks simpler than any of the above.
>
> Luc
>
> > 2013/4/25 Softaddicts 
> >
> > > user=> (apropos "inline")
> > > (definline)
> > >
> >
> > Yeah, yeah. It all starts with (apropos "apropos"), right?
> >
> > I knew it.
> > --
> > MK
> >
> > http://github.com/michaelklishin
> > http://twitter.com/michaelklishin
> >
> > --
> > --
> > 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.
> >
> >
> >
> --
> Softaddicts sent by ibisMail from my ipad!
>
> --
> --
> 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: Do functions never get inlined by jvm?

2013-04-25 Thread Michael Klishin
2013/4/25 Softaddicts 

> Inlining is a concept that existed for more than 40 years in many
> programming
> languages. It's not anything new.
>

The OP probably know what inlining is because, hm, the subject has that
word.
Then she is recommended to use something that only technically has
documentation (and is marked as experimental) and is not known or used by
many.

I've pointed that out. Problem?
-- 
MK

http://github.com/michaelklishin
http://twitter.com/michaelklishin

-- 
-- 
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: Do functions never get inlined by jvm?

2013-04-25 Thread Softaddicts
You asked a simple question, you got a plain answer.
Now if you are still grunting there's not much I can do about that.

I do agree that the doc string could be a bit more descriptive.
But what does it mean to be understandable by "normal" users ?
I am still trying to size what is a "normal" Lisp user these days.
No single answer seems to fit so far.

When I first used Lisp, inlining meant writing pseudo assembly code
right through your Lisp code most of the time using a macro.
Procedural languages had most of the time
extension directives to allow you to force inlining at your will.

Inlining is a concept that existed for more than 40 years in many programming
languages. It's not anything new. Now if you want to use it but do not
understand the implications, well it's not the doc string that will explain
it to you.

To me, definline looks simpler than any of the above.

Luc

> 2013/4/25 Softaddicts 
> 
> > user=> (apropos "inline")
> > (definline)
> >
> 
> Yeah, yeah. It all starts with (apropos "apropos"), right?
> 
> I knew it.
> -- 
> MK
> 
> http://github.com/michaelklishin
> http://twitter.com/michaelklishin
> 
> -- 
> -- 
> 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.
> 
> 
> 
--
Softaddicts sent by ibisMail from my ipad!

-- 
-- 
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: Do functions never get inlined by jvm?

2013-04-25 Thread Michael Klishin
2013/4/25 Softaddicts 

> user=> (apropos "inline")
> (definline)
>

Yeah, yeah. It all starts with (apropos "apropos"), right?

I knew it.
-- 
MK

http://github.com/michaelklishin
http://twitter.com/michaelklishin

-- 
-- 
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: Do functions never get inlined by jvm?

2013-04-25 Thread Softaddicts
user=> (apropos "inline")
(definline)
user=> (doc inline)
..




> 2013/4/25 David Nolen 
> 
> > (doc definline)
> 
> 
> Macro
>   Experimental - like defmacro, except defines a named function whose
>   body is the expansion, calls to which may be expanded inline as if
>   it were a macro. Cannot be used with variadic (&) args.
> 
> If you think this is useful to regular users (who have no idea about the
> compiler internals or JVM), you may want to reconsider.
> 
> Also, if I don't know definline exists, how do I find out? Books, docs
> don't mention it.
> 1 page on clojure.org that you have to find doesn't count.
> -- 
> MK
> 
> http://github.com/michaelklishin
> http://twitter.com/michaelklishin
> 
> -- 
> -- 
> 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.
> 
> 
> 
--
Softaddicts sent by ibisMail from my ipad!

-- 
-- 
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: Do functions never get inlined by jvm?

2013-04-25 Thread Michael Klishin
2013/4/25 David Nolen 

> (doc definline)


Macro
  Experimental - like defmacro, except defines a named function whose
  body is the expansion, calls to which may be expanded inline as if
  it were a macro. Cannot be used with variadic (&) args.

If you think this is useful to regular users (who have no idea about the
compiler internals or JVM), you may want to reconsider.

Also, if I don't know definline exists, how do I find out? Books, docs
don't mention it.
1 page on clojure.org that you have to find doesn't count.
-- 
MK

http://github.com/michaelklishin
http://twitter.com/michaelklishin

-- 
-- 
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: Do functions never get inlined by jvm?

2013-04-25 Thread David Nolen
(doc definline)


On Thu, Apr 25, 2013 at 1:17 PM, Michael Klishin <
michael.s.klis...@gmail.com> wrote:

>
> 2013/4/25 David Nolen 
>
>> + :inline metadata
>
>
> Which is not documented anywhere and might as well not exist for regular
> Clojure users.
> --
> MK
>
> http://github.com/michaelklishin
> http://twitter.com/michaelklishin
>
> --
> --
> 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: Do functions never get inlined by jvm?

2013-04-25 Thread Michael Klishin
2013/4/25 David Nolen 

> + :inline metadata


Which is not documented anywhere and might as well not exist for regular
Clojure users.
-- 
MK

http://github.com/michaelklishin
http://twitter.com/michaelklishin

-- 
-- 
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: Do functions never get inlined by jvm?

2013-04-25 Thread David Nolen
It just doesn't accurately describe how primitive fns work when used
non-higher order, nor is it correct for the tricks you can play with
non-higher order fn usage + :inline metadata. JVM will aggressively inline
these cases.


On Thu, Apr 25, 2013 at 1:03 PM, Alice  wrote:

> Care to elaborate which part is out of date?
>
> On Apr 26, 1:48 am, David Nolen  wrote:
> > Which is out of date.
> >
> >
> >
> >
> >
> >
> >
> > On Thu, Apr 25, 2013 at 12:47 PM, Alice  wrote:
> > > Found this blog post written by fogus:
> >
> > > "To provide this level of flexibility Clojure establishes a level of
> > > indirection. Specifically, all function lookups through a Var occur,
> > > at the lowest level, through an atomic volatile. This happens every
> > > time that a function bound using the def/defn special forms is called.
> > > This indirection is not amenable to HotSpot optimizations."
> >
> > >http://blog.fogus.me/2011/10/14/why-clojure-doesnt-need-invokedynamic.
> ..
> >
> > > On Apr 25, 10:19 pm, Alice  wrote:
> > > > I create many small methods in java without worrying about the
> > > > performance since it's usually the target of inline optimization. For
> > > > example,
> >
> > > > public class Foo {
> > > >   public static long inc(long l) {
> > > > return ++l;
> > > >   }
> >
> > > >   public static long f1() {
> > > > long l = 0;
> > > > for (int i=0; i < 10; i++) {
> > > >   l++;
> > > > }
> > > > return l;
> > > >   }
> >
> > > >   public static long f2() {
> > > > long l = 0;
> > > > for (int i=0; i < 10; i++) {
> > > >   l = inc(l);
> > > > }
> > > > return l;
> > > >   }
> >
> > > > }
> >
> > > > (time (Foo/f1))
> > > > (time (Foo/f1))
> > > > (time (Foo/f1))
> > > > (time (Foo/f2))
> > > > (time (Foo/f2))
> > > > (time (Foo/f2))
> >
> > > > "Elapsed time: 23.309532 msecs"
> > > > "Elapsed time: 23.333039 msecs"
> > > > "Elapsed time: 21.714753 msecs"
> > > > "Elapsed time: 22.943366 msecs"
> > > > "Elapsed time: 21.612783 msecs"
> > > > "Elapsed time: 21.71376 msecs"
> >
> > > > But clojure funtions seem to be never get inlined.
> >
> > > > (def obj (Object.))
> >
> > > > (defn getObj [] obj)
> >
> > > > (defn f1 [] obj)
> > > > (defn f2 [] (getObj))
> >
> > > > (time (dotimes [n 1] (f1)))
> > > > (time (dotimes [n 1] (f1)))
> > > > (time (dotimes [n 1] (f1)))
> > > > (time (dotimes [n 1] (f2)))
> > > > (time (dotimes [n 1] (f2)))
> > > > (time (dotimes [n 1] (f2)))
> >
> > > > "Elapsed time: 67.758744 msecs"
> > > > "Elapsed time: 68.555306 msecs"
> > > > "Elapsed time: 68.725147 msecs"
> > > > "Elapsed time: 104.810459 msecs"
> > > > "Elapsed time: 103.273618 msecs"
> > > > "Elapsed time: 103.374595 msecs"
> >
> > > --
> > > --
> > > 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, visithttps://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/g

Re: Do functions never get inlined by jvm?

2013-04-25 Thread Alice
Care to elaborate which part is out of date?

On Apr 26, 1:48 am, David Nolen  wrote:
> Which is out of date.
>
>
>
>
>
>
>
> On Thu, Apr 25, 2013 at 12:47 PM, Alice  wrote:
> > Found this blog post written by fogus:
>
> > "To provide this level of flexibility Clojure establishes a level of
> > indirection. Specifically, all function lookups through a Var occur,
> > at the lowest level, through an atomic volatile. This happens every
> > time that a function bound using the def/defn special forms is called.
> > This indirection is not amenable to HotSpot optimizations."
>
> >http://blog.fogus.me/2011/10/14/why-clojure-doesnt-need-invokedynamic...
>
> > On Apr 25, 10:19 pm, Alice  wrote:
> > > I create many small methods in java without worrying about the
> > > performance since it's usually the target of inline optimization. For
> > > example,
>
> > > public class Foo {
> > >   public static long inc(long l) {
> > >     return ++l;
> > >   }
>
> > >   public static long f1() {
> > >     long l = 0;
> > >     for (int i=0; i < 10; i++) {
> > >       l++;
> > >     }
> > >     return l;
> > >   }
>
> > >   public static long f2() {
> > >     long l = 0;
> > >     for (int i=0; i < 10; i++) {
> > >       l = inc(l);
> > >     }
> > >     return l;
> > >   }
>
> > > }
>
> > > (time (Foo/f1))
> > > (time (Foo/f1))
> > > (time (Foo/f1))
> > > (time (Foo/f2))
> > > (time (Foo/f2))
> > > (time (Foo/f2))
>
> > > "Elapsed time: 23.309532 msecs"
> > > "Elapsed time: 23.333039 msecs"
> > > "Elapsed time: 21.714753 msecs"
> > > "Elapsed time: 22.943366 msecs"
> > > "Elapsed time: 21.612783 msecs"
> > > "Elapsed time: 21.71376 msecs"
>
> > > But clojure funtions seem to be never get inlined.
>
> > > (def obj (Object.))
>
> > > (defn getObj [] obj)
>
> > > (defn f1 [] obj)
> > > (defn f2 [] (getObj))
>
> > > (time (dotimes [n 1] (f1)))
> > > (time (dotimes [n 1] (f1)))
> > > (time (dotimes [n 1] (f1)))
> > > (time (dotimes [n 1] (f2)))
> > > (time (dotimes [n 1] (f2)))
> > > (time (dotimes [n 1] (f2)))
>
> > > "Elapsed time: 67.758744 msecs"
> > > "Elapsed time: 68.555306 msecs"
> > > "Elapsed time: 68.725147 msecs"
> > > "Elapsed time: 104.810459 msecs"
> > > "Elapsed time: 103.273618 msecs"
> > > "Elapsed time: 103.374595 msecs"
>
> > --
> > --
> > 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, visithttps://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: Do functions never get inlined by jvm?

2013-04-25 Thread David Nolen
Which is out of date.


On Thu, Apr 25, 2013 at 12:47 PM, Alice  wrote:

> Found this blog post written by fogus:
>
> "To provide this level of flexibility Clojure establishes a level of
> indirection. Specifically, all function lookups through a Var occur,
> at the lowest level, through an atomic volatile. This happens every
> time that a function bound using the def/defn special forms is called.
> This indirection is not amenable to HotSpot optimizations."
>
>
> http://blog.fogus.me/2011/10/14/why-clojure-doesnt-need-invokedynamic-but-it-might-be-nice/
>
> On Apr 25, 10:19 pm, Alice  wrote:
> > I create many small methods in java without worrying about the
> > performance since it's usually the target of inline optimization. For
> > example,
> >
> > public class Foo {
> >   public static long inc(long l) {
> > return ++l;
> >   }
> >
> >   public static long f1() {
> > long l = 0;
> > for (int i=0; i < 10; i++) {
> >   l++;
> > }
> > return l;
> >   }
> >
> >   public static long f2() {
> > long l = 0;
> > for (int i=0; i < 10; i++) {
> >   l = inc(l);
> > }
> > return l;
> >   }
> >
> > }
> >
> > (time (Foo/f1))
> > (time (Foo/f1))
> > (time (Foo/f1))
> > (time (Foo/f2))
> > (time (Foo/f2))
> > (time (Foo/f2))
> >
> > "Elapsed time: 23.309532 msecs"
> > "Elapsed time: 23.333039 msecs"
> > "Elapsed time: 21.714753 msecs"
> > "Elapsed time: 22.943366 msecs"
> > "Elapsed time: 21.612783 msecs"
> > "Elapsed time: 21.71376 msecs"
> >
> > But clojure funtions seem to be never get inlined.
> >
> > (def obj (Object.))
> >
> > (defn getObj [] obj)
> >
> > (defn f1 [] obj)
> > (defn f2 [] (getObj))
> >
> > (time (dotimes [n 1] (f1)))
> > (time (dotimes [n 1] (f1)))
> > (time (dotimes [n 1] (f1)))
> > (time (dotimes [n 1] (f2)))
> > (time (dotimes [n 1] (f2)))
> > (time (dotimes [n 1] (f2)))
> >
> > "Elapsed time: 67.758744 msecs"
> > "Elapsed time: 68.555306 msecs"
> > "Elapsed time: 68.725147 msecs"
> > "Elapsed time: 104.810459 msecs"
> > "Elapsed time: 103.273618 msecs"
> > "Elapsed time: 103.374595 msecs"
>
> --
> --
> 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: Do functions never get inlined by jvm?

2013-04-25 Thread Alice
Found this blog post written by fogus:

"To provide this level of flexibility Clojure establishes a level of
indirection. Specifically, all function lookups through a Var occur,
at the lowest level, through an atomic volatile. This happens every
time that a function bound using the def/defn special forms is called.
This indirection is not amenable to HotSpot optimizations."

http://blog.fogus.me/2011/10/14/why-clojure-doesnt-need-invokedynamic-but-it-might-be-nice/

On Apr 25, 10:19 pm, Alice  wrote:
> I create many small methods in java without worrying about the
> performance since it's usually the target of inline optimization. For
> example,
>
> public class Foo {
>   public static long inc(long l) {
>     return ++l;
>   }
>
>   public static long f1() {
>     long l = 0;
>     for (int i=0; i < 10; i++) {
>       l++;
>     }
>     return l;
>   }
>
>   public static long f2() {
>     long l = 0;
>     for (int i=0; i < 10; i++) {
>       l = inc(l);
>     }
>     return l;
>   }
>
> }
>
> (time (Foo/f1))
> (time (Foo/f1))
> (time (Foo/f1))
> (time (Foo/f2))
> (time (Foo/f2))
> (time (Foo/f2))
>
> "Elapsed time: 23.309532 msecs"
> "Elapsed time: 23.333039 msecs"
> "Elapsed time: 21.714753 msecs"
> "Elapsed time: 22.943366 msecs"
> "Elapsed time: 21.612783 msecs"
> "Elapsed time: 21.71376 msecs"
>
> But clojure funtions seem to be never get inlined.
>
> (def obj (Object.))
>
> (defn getObj [] obj)
>
> (defn f1 [] obj)
> (defn f2 [] (getObj))
>
> (time (dotimes [n 1] (f1)))
> (time (dotimes [n 1] (f1)))
> (time (dotimes [n 1] (f1)))
> (time (dotimes [n 1] (f2)))
> (time (dotimes [n 1] (f2)))
> (time (dotimes [n 1] (f2)))
>
> "Elapsed time: 67.758744 msecs"
> "Elapsed time: 68.555306 msecs"
> "Elapsed time: 68.725147 msecs"
> "Elapsed time: 104.810459 msecs"
> "Elapsed time: 103.273618 msecs"
> "Elapsed time: 103.374595 msecs"

-- 
-- 
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: Do functions never get inlined by jvm?

2013-04-25 Thread David Nolen
You have to be very careful with microbenchmarks like this. I recommend
writing less trivial benchmarks. For example
http://github.com/clojure/test.benchmark/blob/master/src/main/clojure/alioth/spectral_norm.clj

This code demonstrates performance on par with plain Java. There are many
other similar examples in the test.benchark project.

David


On Thu, Apr 25, 2013 at 9:44 AM, Alice  wrote:

> Primitive hinted funtions seem to be not an exception.
>
> (defn my-inc ^long [^long l] (inc l))
>
> (defn f1 [^long l] (inc l))
> (defn f2 [^long l] (my-inc l))
>
> (time (dotimes [n 1] (f1 1)))
> (time (dotimes [n 1] (f1 1)))
> (time (dotimes [n 1] (f1 1)))
> (time (dotimes [n 1] (f2 1)))
> (time (dotimes [n 1] (f2 1)))
> (time (dotimes [n 1] (f2 1)))
>
> "Elapsed time: 68.683431 msecs"
> "Elapsed time: 68.964182 msecs"
> "Elapsed time: 68.105047 msecs"
> "Elapsed time: 108.576746 msecs"
> "Elapsed time: 100.992193 msecs"
> "Elapsed time: 100.945511 msecs"
>
> On Apr 25, 10:32 pm, David Nolen  wrote:
> > primitive hinted fns will get inlined. You can also play the same kinds
> of
> > games that Clojure does with definterface+deftype and fns that declare
> > :inline metadata.
> >
> > If you don't want to learn the subtleties of Clojure performance tuning
> > then you can always write your performance critical bits in Java and call
> > into it. Some folks, like the people at Prismatic, seem to be doing
> pretty
> > well writing all their performance critical code in Clojure, but they've
> > built some tools to avoid the various potential pitfalls.
> >
> >
> >
> >
> >
> >
> >
> > On Thu, Apr 25, 2013 at 9:19 AM, Alice  wrote:
> > > I create many small methods in java without worrying about the
> > > performance since it's usually the target of inline optimization. For
> > > example,
> >
> > > public class Foo {
> > >   public static long inc(long l) {
> > > return ++l;
> > >   }
> >
> > >   public static long f1() {
> > > long l = 0;
> > > for (int i=0; i < 10; i++) {
> > >   l++;
> > > }
> > > return l;
> > >   }
> >
> > >   public static long f2() {
> > > long l = 0;
> > > for (int i=0; i < 10; i++) {
> > >   l = inc(l);
> > > }
> > > return l;
> > >   }
> > > }
> >
> > > (time (Foo/f1))
> > > (time (Foo/f1))
> > > (time (Foo/f1))
> > > (time (Foo/f2))
> > > (time (Foo/f2))
> > > (time (Foo/f2))
> >
> > > "Elapsed time: 23.309532 msecs"
> > > "Elapsed time: 23.333039 msecs"
> > > "Elapsed time: 21.714753 msecs"
> > > "Elapsed time: 22.943366 msecs"
> > > "Elapsed time: 21.612783 msecs"
> > > "Elapsed time: 21.71376 msecs"
> >
> > > But clojure funtions seem to be never get inlined.
> >
> > > (def obj (Object.))
> >
> > > (defn getObj [] obj)
> >
> > > (defn f1 [] obj)
> > > (defn f2 [] (getObj))
> >
> > > (time (dotimes [n 1] (f1)))
> > > (time (dotimes [n 1] (f1)))
> > > (time (dotimes [n 1] (f1)))
> > > (time (dotimes [n 1] (f2)))
> > > (time (dotimes [n 1] (f2)))
> > > (time (dotimes [n 1] (f2)))
> >
> > > "Elapsed time: 67.758744 msecs"
> > > "Elapsed time: 68.555306 msecs"
> > > "Elapsed time: 68.725147 msecs"
> > > "Elapsed time: 104.810459 msecs"
> > > "Elapsed time: 103.273618 msecs"
> > > "Elapsed time: 103.374595 msecs"
> >
> > > --
> > > --
> > > 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, visithttps://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

Re: Do functions never get inlined by jvm?

2013-04-25 Thread Jonathan Fischer Friberg
If that's a problem, you could try https://github.com/hugoduncan/criterium


On Thu, Apr 25, 2013 at 5:38 PM, Phil Hagelberg  wrote:

> Three repetitions is not nearly enough to get a feel for how hotspot
> optimizes functions when it detects they're in a tight loop. I don't know
> how javac works, but Clojure doesn't optimize much for cases where hotspot
> can do a much better job over time.
>
> -Phil
>
> --
> --
> 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: Do functions never get inlined by jvm?

2013-04-25 Thread Phil Hagelberg
Three repetitions is not nearly enough to get a feel for how hotspot
optimizes functions when it detects they're in a tight loop. I don't know
how javac works, but Clojure doesn't optimize much for cases where hotspot
can do a much better job over time.

-Phil

-- 
-- 
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: Do functions never get inlined by jvm?

2013-04-25 Thread Ambrose Bonnaire-Sergeant
jvm.tools.analyzer is a nice tool for exploration in this area.

I don't personally know all the subtleties here, but after some playing I
managed to emit an unboxing function.
I could tell from the AST.

https://gist.github.com/frenchy64/5459989

Thanks,
Ambrose


On Thu, Apr 25, 2013 at 9:44 PM, Alice  wrote:

> Primitive hinted funtions seem to be not an exception.
>
> (defn my-inc ^long [^long l] (inc l))
>
> (defn f1 [^long l] (inc l))
> (defn f2 [^long l] (my-inc l))
>
> (time (dotimes [n 1] (f1 1)))
> (time (dotimes [n 1] (f1 1)))
> (time (dotimes [n 1] (f1 1)))
> (time (dotimes [n 1] (f2 1)))
> (time (dotimes [n 1] (f2 1)))
> (time (dotimes [n 1] (f2 1)))
>
> "Elapsed time: 68.683431 msecs"
> "Elapsed time: 68.964182 msecs"
> "Elapsed time: 68.105047 msecs"
> "Elapsed time: 108.576746 msecs"
> "Elapsed time: 100.992193 msecs"
> "Elapsed time: 100.945511 msecs"
>
> On Apr 25, 10:32 pm, David Nolen  wrote:
> > primitive hinted fns will get inlined. You can also play the same kinds
> of
> > games that Clojure does with definterface+deftype and fns that declare
> > :inline metadata.
> >
> > If you don't want to learn the subtleties of Clojure performance tuning
> > then you can always write your performance critical bits in Java and call
> > into it. Some folks, like the people at Prismatic, seem to be doing
> pretty
> > well writing all their performance critical code in Clojure, but they've
> > built some tools to avoid the various potential pitfalls.
> >
> >
> >
> >
> >
> >
> >
> > On Thu, Apr 25, 2013 at 9:19 AM, Alice  wrote:
> > > I create many small methods in java without worrying about the
> > > performance since it's usually the target of inline optimization. For
> > > example,
> >
> > > public class Foo {
> > >   public static long inc(long l) {
> > > return ++l;
> > >   }
> >
> > >   public static long f1() {
> > > long l = 0;
> > > for (int i=0; i < 10; i++) {
> > >   l++;
> > > }
> > > return l;
> > >   }
> >
> > >   public static long f2() {
> > > long l = 0;
> > > for (int i=0; i < 10; i++) {
> > >   l = inc(l);
> > > }
> > > return l;
> > >   }
> > > }
> >
> > > (time (Foo/f1))
> > > (time (Foo/f1))
> > > (time (Foo/f1))
> > > (time (Foo/f2))
> > > (time (Foo/f2))
> > > (time (Foo/f2))
> >
> > > "Elapsed time: 23.309532 msecs"
> > > "Elapsed time: 23.333039 msecs"
> > > "Elapsed time: 21.714753 msecs"
> > > "Elapsed time: 22.943366 msecs"
> > > "Elapsed time: 21.612783 msecs"
> > > "Elapsed time: 21.71376 msecs"
> >
> > > But clojure funtions seem to be never get inlined.
> >
> > > (def obj (Object.))
> >
> > > (defn getObj [] obj)
> >
> > > (defn f1 [] obj)
> > > (defn f2 [] (getObj))
> >
> > > (time (dotimes [n 1] (f1)))
> > > (time (dotimes [n 1] (f1)))
> > > (time (dotimes [n 1] (f1)))
> > > (time (dotimes [n 1] (f2)))
> > > (time (dotimes [n 1] (f2)))
> > > (time (dotimes [n 1] (f2)))
> >
> > > "Elapsed time: 67.758744 msecs"
> > > "Elapsed time: 68.555306 msecs"
> > > "Elapsed time: 68.725147 msecs"
> > > "Elapsed time: 104.810459 msecs"
> > > "Elapsed time: 103.273618 msecs"
> > > "Elapsed time: 103.374595 msecs"
> >
> > > --
> > > --
> > > 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, visithttps://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 moder

Re: Do functions never get inlined by jvm?

2013-04-25 Thread Alice
Primitive hinted funtions seem to be not an exception.

(defn my-inc ^long [^long l] (inc l))

(defn f1 [^long l] (inc l))
(defn f2 [^long l] (my-inc l))

(time (dotimes [n 1] (f1 1)))
(time (dotimes [n 1] (f1 1)))
(time (dotimes [n 1] (f1 1)))
(time (dotimes [n 1] (f2 1)))
(time (dotimes [n 1] (f2 1)))
(time (dotimes [n 1] (f2 1)))

"Elapsed time: 68.683431 msecs"
"Elapsed time: 68.964182 msecs"
"Elapsed time: 68.105047 msecs"
"Elapsed time: 108.576746 msecs"
"Elapsed time: 100.992193 msecs"
"Elapsed time: 100.945511 msecs"

On Apr 25, 10:32 pm, David Nolen  wrote:
> primitive hinted fns will get inlined. You can also play the same kinds of
> games that Clojure does with definterface+deftype and fns that declare
> :inline metadata.
>
> If you don't want to learn the subtleties of Clojure performance tuning
> then you can always write your performance critical bits in Java and call
> into it. Some folks, like the people at Prismatic, seem to be doing pretty
> well writing all their performance critical code in Clojure, but they've
> built some tools to avoid the various potential pitfalls.
>
>
>
>
>
>
>
> On Thu, Apr 25, 2013 at 9:19 AM, Alice  wrote:
> > I create many small methods in java without worrying about the
> > performance since it's usually the target of inline optimization. For
> > example,
>
> > public class Foo {
> >   public static long inc(long l) {
> >     return ++l;
> >   }
>
> >   public static long f1() {
> >     long l = 0;
> >     for (int i=0; i < 10; i++) {
> >       l++;
> >     }
> >     return l;
> >   }
>
> >   public static long f2() {
> >     long l = 0;
> >     for (int i=0; i < 10; i++) {
> >       l = inc(l);
> >     }
> >     return l;
> >   }
> > }
>
> > (time (Foo/f1))
> > (time (Foo/f1))
> > (time (Foo/f1))
> > (time (Foo/f2))
> > (time (Foo/f2))
> > (time (Foo/f2))
>
> > "Elapsed time: 23.309532 msecs"
> > "Elapsed time: 23.333039 msecs"
> > "Elapsed time: 21.714753 msecs"
> > "Elapsed time: 22.943366 msecs"
> > "Elapsed time: 21.612783 msecs"
> > "Elapsed time: 21.71376 msecs"
>
> > But clojure funtions seem to be never get inlined.
>
> > (def obj (Object.))
>
> > (defn getObj [] obj)
>
> > (defn f1 [] obj)
> > (defn f2 [] (getObj))
>
> > (time (dotimes [n 1] (f1)))
> > (time (dotimes [n 1] (f1)))
> > (time (dotimes [n 1] (f1)))
> > (time (dotimes [n 1] (f2)))
> > (time (dotimes [n 1] (f2)))
> > (time (dotimes [n 1] (f2)))
>
> > "Elapsed time: 67.758744 msecs"
> > "Elapsed time: 68.555306 msecs"
> > "Elapsed time: 68.725147 msecs"
> > "Elapsed time: 104.810459 msecs"
> > "Elapsed time: 103.273618 msecs"
> > "Elapsed time: 103.374595 msecs"
>
> > --
> > --
> > 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, visithttps://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: Do functions never get inlined by jvm?

2013-04-25 Thread David Nolen
primitive hinted fns will get inlined. You can also play the same kinds of
games that Clojure does with definterface+deftype and fns that declare
:inline metadata.

If you don't want to learn the subtleties of Clojure performance tuning
then you can always write your performance critical bits in Java and call
into it. Some folks, like the people at Prismatic, seem to be doing pretty
well writing all their performance critical code in Clojure, but they've
built some tools to avoid the various potential pitfalls.


On Thu, Apr 25, 2013 at 9:19 AM, Alice  wrote:

> I create many small methods in java without worrying about the
> performance since it's usually the target of inline optimization. For
> example,
>
> public class Foo {
>   public static long inc(long l) {
> return ++l;
>   }
>
>   public static long f1() {
> long l = 0;
> for (int i=0; i < 10; i++) {
>   l++;
> }
> return l;
>   }
>
>   public static long f2() {
> long l = 0;
> for (int i=0; i < 10; i++) {
>   l = inc(l);
> }
> return l;
>   }
> }
>
> (time (Foo/f1))
> (time (Foo/f1))
> (time (Foo/f1))
> (time (Foo/f2))
> (time (Foo/f2))
> (time (Foo/f2))
>
> "Elapsed time: 23.309532 msecs"
> "Elapsed time: 23.333039 msecs"
> "Elapsed time: 21.714753 msecs"
> "Elapsed time: 22.943366 msecs"
> "Elapsed time: 21.612783 msecs"
> "Elapsed time: 21.71376 msecs"
>
>
> But clojure funtions seem to be never get inlined.
>
> (def obj (Object.))
>
> (defn getObj [] obj)
>
> (defn f1 [] obj)
> (defn f2 [] (getObj))
>
> (time (dotimes [n 1] (f1)))
> (time (dotimes [n 1] (f1)))
> (time (dotimes [n 1] (f1)))
> (time (dotimes [n 1] (f2)))
> (time (dotimes [n 1] (f2)))
> (time (dotimes [n 1] (f2)))
>
> "Elapsed time: 67.758744 msecs"
> "Elapsed time: 68.555306 msecs"
> "Elapsed time: 68.725147 msecs"
> "Elapsed time: 104.810459 msecs"
> "Elapsed time: 103.273618 msecs"
> "Elapsed time: 103.374595 msecs"
>
> --
> --
> 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.




Do functions never get inlined by jvm?

2013-04-25 Thread Alice
I create many small methods in java without worrying about the
performance since it's usually the target of inline optimization. For
example,

public class Foo {
  public static long inc(long l) {
return ++l;
  }

  public static long f1() {
long l = 0;
for (int i=0; i < 10; i++) {
  l++;
}
return l;
  }

  public static long f2() {
long l = 0;
for (int i=0; i < 10; i++) {
  l = inc(l);
}
return l;
  }
}

(time (Foo/f1))
(time (Foo/f1))
(time (Foo/f1))
(time (Foo/f2))
(time (Foo/f2))
(time (Foo/f2))

"Elapsed time: 23.309532 msecs"
"Elapsed time: 23.333039 msecs"
"Elapsed time: 21.714753 msecs"
"Elapsed time: 22.943366 msecs"
"Elapsed time: 21.612783 msecs"
"Elapsed time: 21.71376 msecs"


But clojure funtions seem to be never get inlined.

(def obj (Object.))

(defn getObj [] obj)

(defn f1 [] obj)
(defn f2 [] (getObj))

(time (dotimes [n 1] (f1)))
(time (dotimes [n 1] (f1)))
(time (dotimes [n 1] (f1)))
(time (dotimes [n 1] (f2)))
(time (dotimes [n 1] (f2)))
(time (dotimes [n 1] (f2)))

"Elapsed time: 67.758744 msecs"
"Elapsed time: 68.555306 msecs"
"Elapsed time: 68.725147 msecs"
"Elapsed time: 104.810459 msecs"
"Elapsed time: 103.273618 msecs"
"Elapsed time: 103.374595 msecs"

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