speed of C# vs Nemerle

90 views
Skip to first unread message

paw

unread,
Nov 4, 2008, 7:27:33 PM11/4/08
to Nemerle Forum
I love the design of Nemerle, and wanted to do some tests before
starting a project with it.
This is an inner loop of a test program that works on arrays of length
95,000,000:

for (mutable j = periods+1; j < dat.Length; j++) {
sumD = sumD + (periods * dat[j]) - (runSum[j-1] - runSum[j
- periods-1]);
movAvg[j] = (sumD * scale) :> float
}

Starting in debug mode, this takes 4.9 seconds on my laptop (Vista 64,
8 gb RAM) under Nemerle,
while the C# version (Visual Studio Express) takes 4.6 seconds; not
bad. However, running w/o debug
takes EXACTLY the same time on Nemerle, but only 2.0 seconds on C#.
Is this something to do
with the design of Nemerle, or just a fixable problem with the Visual
Studion integration?

Thanks,
Terry

VladD2

unread,
Nov 5, 2008, 9:26:07 AM11/5/08
to nemer...@googlegroups.com
macro "for" have bad implementation.
Try use function with tail recursion.

def loop(j)
{
when (j < dat.Length)
{


sumD = sumD + (periods * dat[j]) - (runSum[j-1] - runSum[j - periods-1]);
movAvg[j] = (sumD * scale) :> float

loop(j + 1)
}
}

paw

unread,
Nov 5, 2008, 1:57:52 PM11/5/08
to Nemerle Forum
It's very kind of you to reply and offer a suggestion, thanks!

I tried the recursive form, and it took just the same time as the
for loop. It's great to know that the recursion is so efficient as
to be comparable! Although I think here most of the time is spent
doing the floating point math. Perhaps I should submit a bug
report; it seems wrong that it takes the same time with and
w/o being in debug mode, while C# is over 2x faster when NOT in
debug mode. I should have mentioned that I'm running the
"May 2008 CTP build 0.9.4.8036", which seems to have some
issues with a 64-bit OS.
> }- Hide quoted text -
>
> - Show quoted text -

VladD2

unread,
Nov 6, 2008, 6:30:45 AM11/6/08
to nemer...@googlegroups.com
Show the complete (compilable) tests here, please.

2008/11/5 paw <taw...@gmail.com>:

--
С уважением,
Чистяков Владислав,
www.rsdn.ru

paw

unread,
Nov 6, 2008, 11:57:30 PM11/6/08
to Nemerle Forum
Logically, it seems pretty clear this is just another Visual Studio
integration issue, especially since there are several other problems.
My intelliSense doesn't work either, etc., as pointed out in the bug
reports.

So there is no way now for a user with an up-to-date Windows computer
(but no easy access to a Linux machine) to really evaluate Nemerle?
I installed Mono for Windows on my machine, but there doesn't seem
to be an easy-to-install package on the Nemerle site to get that
working either....

It seems a shame, because right now functional languages are much
in the news (due to F# coming out, and the potential advantages
for using multi-core processors), and I'm sure more people are
at least giving Nemerle a quick look...


On Nov 6, 6:30 am, VladD2 <v...@rsdn.ru> wrote:
> Show the complete (compilable) tests here, please.
>
> 2008/11/5 paw <taw5...@gmail.com>:
> Чистяков Владислав,www.rsdn.ru- Hide quoted text -

paw

unread,
Nov 9, 2008, 12:35:28 PM11/9/08
to Nemerle Forum
Well, I broke down and ordered a cheap copy of Visual Studio 2005;
maybe this plus the "March 2008 CTP build 0.9.4.7967" will work...
> > Чистяков Владислав,www.rsdn.ru-Hide quoted text -
>
> > - Show quoted text -- Hide quoted text -
Reply all
Reply to author
Forward
0 new messages