Re: Disparity between Nim and C performance

2019-05-10 Thread jasper
Use `const` instead of `let` when you can, or just build with --implicitStatic:on. Measurements on my computer: ./optimized_nim 1.01s user 0.00s system 99% cpu 1.012 total ./optimized_c 1.00s user 0.00s system 99% cpu 1.010 total Run

USB Error on Epson Printer

2019-05-10 Thread lbrown7278
I will be better to visit and consult with the site mentioned here [https://errorcode0x.com/fix-epson-error-code-0xf4](https://errorcode0x.com/fix-epson-error-code-0xf4)/ to get the entire guidance regarding the computer algebra system module. It will help you provide the required information

Re: is there computer algebra system module?

2019-05-10 Thread lbrown7278
thanks.

Re: Disparity between Nim and C performance

2019-05-10 Thread cantanima
> Can you show us the optimized Nim code too... Sure. I left it out because the post was already long. let m2 = 10 m1 = 3*m2 b1 = 127 b2 = 256 mul = 102 a1 = 101 a2 = 7 a = (a1 shl m1) + a2 b = (b1 shl m1) + b2

Re: Disparity between Nim and C performance

2019-05-10 Thread cantanima
Oh -- the Nim compiler is 0.19.4. I originally encountered this some months ago on an older Nim compiler, but decided to wait for a newer one before asking about it. Then I just forgot until tonight.

Re: is there computer algebra system module?

2019-05-10 Thread lbrown7278
I will be better to visit and consult with the site mentioned here [https://errorcode0x.com/fix-epson-error-code-0xf4](https://errorcode0x.com/fix-epson-error-code-0xf4)/ to get the entire guidance regarding the computer algebra system module. It will help you provide the required information

Re: Disparity between Nim and C performance

2019-05-10 Thread miran
> Here's the un-optimized Nim code. Can you show us the optimized Nim code too, so that we can see if we can reproduce this large discrepancy?

Disparity between Nim and C performance

2019-05-10 Thread cantanima
Hello all I was trying to optimize some modular arithmetic in a C++ program, and I had the idea to try it in Nim first. The idea is to pack two (or more) small integers into a 64-bit integer, perform a bunch of arithmetic, checking after addition or multiplication whether one of them has grown

Re: Unexpected error from the C compiler with Option

2019-05-10 Thread quokka70
Done: [https://github.com/nim-lang/Nim/issues/11228](https://github.com/nim-lang/Nim/issues/11228)

Re: Unexpected error from the C compiler with Option

2019-05-10 Thread shashlick
This belongs in the issue tracker: [https://github.com/nim-lang/nim/issues](https://github.com/nim-lang/nim/issues)

Unexpected error from the C compiler with Option

2019-05-10 Thread quokka70
Hi, Consider the following code # strange_option.nim import options let a: Option[int] = none(var int) Run When I compile with `nim c strange_option.nim` I get the following error Hint: used config file

Data-oriented design, interleaved/noninterleaved data batches (AoS, SoA), worker threads etc.

2019-05-10 Thread deorder
What would be the equivalent of the following code in Nim (especially the `rigidbody_t` structure and `physics_integrate` function)? [https://pastebin.com/gXkBtHCE](https://pastebin.com/gXkBtHCE) I want to create job functions running on (long-living) worker threads (#cores - 1) that can act

Re: Understanding performance compared to Numpy

2019-05-10 Thread jlhouchin
Thanks for all the replies. I will have to take some time later to analyze the more idiomatic code above and learn. I understand my code may not appear to make sense. It's primary purpose is simply to provide somewhat of a stress test of what I might commonly do in various methods/functions.

Re: Understanding performance compared to Numpy

2019-05-10 Thread lscrd
Very interesting explanation. As regards Python floats, they are native floats (64 bits long in IEEE 754 format), not arbitrary precision floats. Only integers are in arbitrary precision. So, I think that the rounding errors are also present in the Python program.

Re: Understanding performance compared to Numpy

2019-05-10 Thread mratsim
Quick eureka before I sleep. The bulk of processing is in the `sum` function for both Python and Nim, as @Stefan_Salewski you should store the previous result because right now the algorithm is doing an extra useless pass on `farray`, furthermore this relies on the initialization of that empty

Re: problem with ARM build/install (BeagleBone) or cross-compiling from

2019-05-10 Thread shashlick
I just made an armv7a build on 0.19.6 for test purposes. Please let me know if it works as expected. I plan making it a part of nightlies soon.

Re: Understanding performance compared to Numpy

2019-05-10 Thread mratsim
Hey there, This would be an idiomatic Nim translation of your program (and the result is more similar to the Python one). import os, strutils, times, math, parsecsv, streams const CsvPath = "./build/EUR_USD_Week1.csv" # Row:

Re: Understanding performance compared to Numpy

2019-05-10 Thread Stefan_Salewski
Unfortunately I can not really understand your code... But it looks a bit strange for me. for price in prices: pcount += 1 farray[pcount] = ((price * price) * ((pcount+1) / prices.len)) pips += price psum = farray.sum() Run In this loop you

Understanding performance compared to Numpy

2019-05-10 Thread jlhouchin
Hello, I have some code that I am trying to understand why it is slower than Python/Numpy. I am not a C programmer and Nim is my first real attempt to learn a systems level, statically compiled language. But to my understanding Nim should approach C speeds to a certain extent. If what I

Re: Conditional compilation in imported module based on constant?

2019-05-10 Thread quokka70
Oh! Yes, `include` will give me the behavior I want. I have been working to keep the modules separate, but I won't need to use any of them outside of my learning project, so `include` isn't the end of the world.

Re: Problem sorting OrderedTable of seq[Rec]

2019-05-10 Thread mratsim
I must say that I'm amazed that you worked on Table sorting for 3 years!

Re: Conditional compilation in imported module based on constant?

2019-05-10 Thread quokka70
That works fine when I set the const from the command line when building: $ nim c -r -d:is_it_for_algo_N=1 algo_1 $ nim c -r -d:is_it_for_algo_N=2 algo_2 Run But it isn't enough to "set" the const in the algo-specific source file: # In algo_.nim

Re: Conditional compilation in imported module based on constant?

2019-05-10 Thread yglukhov
Seems like you need to use `include` instead of `import`, along with all of its implications.

Problem sorting OrderedTable of seq[Rec]

2019-05-10 Thread bobg
The syntax of the sort command is sensitive to whitespace (or no WS) For example, the command: sesTab.sort(proc (x,y: (string,SesSeq)): int = result = cmp(x[0], y[0]) ) Run does not compile. However, putting a space after the comma in the type of x,y, allows it to

Re: Nim Syntax ''Skins''

2019-05-10 Thread chibo
> reading through code on Github and other parts of the web? Simple convention > — do not upload to public spaces your preprocessored code, dat simple btw m$ with their .NET CLI compliant languages - tried to get similar approach, but it is a m$, so they ended up with Mono monopoly, heh

Re: Conditional compilation in imported module based on constant?

2019-05-10 Thread mratsim
So the alternative I mentioned doesn't work either? const is_it_for_algo_N {.intdefine.} = 1 when is_it_for_algo_N == 1: type Foo = object val: int elif is_it_for_algo_N == 2: type Foo = object val: string Run

Re: Introducing Norm: a Nim ORM

2019-05-10 Thread johnconway
@moigagoo Thanks for this, I've been using Norm in developing a little microblogging thing, and I like it's simplicity.

Re: Nim Syntax ''Skins''

2019-05-10 Thread chibo
**PRE** **PRO** **CES** **SORS** We have awesome examples like Pug Stylus Coffeescript, but our lang is already compiled, so it easiest things evar, just make preprocessor configuration _(in yaml file would be nice)_ available for user custom schemes, which can be defined global, or shipped

Re: Conditional compilation in imported module based on constant?

2019-05-10 Thread quokka70
Thanks for both of your replies. mratsim: I don't think that approach will give me quite what I want as my import dependencies go the other way. Rather than defining the flag in a file and deciding which file to import from there, I need to import a particular file from each of two places and

Re: Is there way to change «proc» naming?

2019-05-10 Thread chibo
After reading this article [https://en.wikipedia.org/wiki/Pseudocode](https://en.wikipedia.org/wiki/Pseudocode) I'm starting to get involved _(slowly)_ yeah I noticed the length too, really nice look > I’m surprised but I'm not =) it sounds weird, that's why.. anyway I found nice thread

Re: Introducing Norm: a Nim ORM

2019-05-10 Thread moigagoo
A quick update about the project. Thanks to [alaviss](https://github.com/alaviss), SQLite backend supports onUpdate and onDelete pragmas, foreign key handling now works (even with multiple FKs). getOne can retrieve a record not only by ID, but also by condition. getMany and getOne procs now

Re: Conditional compilation in imported module based on constant?

2019-05-10 Thread mratsim
const is_it_for_algo_N {.intdefine.} = 1 when is_it_for_algo_N == 1: import A elif is_it_for_algo_N == 2: import B Run And pass `nim c -d:is_it_for_algo_N=2 yourfile.nim` Or just put the alternate type definition instead of the imports.

Re: Conditional compilation in imported module based on constant?

2019-05-10 Thread mashingan
> Can I specify binary-specific defines for the nimble build process? You can specify which kind of binary built with nimble task. See [here](https://github.com/nim-lang/nimble#creating-packages) You can also make a config file specific to your nim file so the name is _yourfile.nim.cfg_ and