C# GUI on top of C hard calculation engine -


some time ago, developed mathematical plotter in c# draws functions in various geometrical spaces through old, "dumb", numerical calculations. users inserts n-variable equation or curve simplified , semicompiled, calculated entire set of combinations of values of variables in domain, , displayed.

i'm working on optimization @ algorithm reduce calculations, far can see there’s no way, problems have manage, go under @ least 5*10^7 operations, in least powerful machines , in c# machine code results 1-1.5 seconds lag, unacceptable, @ least since same code implemented in c 20x faster (and that’s unoptimized version!).

so modify application keeping 80% of old c# "slow" code, gui included, leaving therefore calculation , rendering part "fast" c. "slow" part must pass strings , int params "fast" engine, , receive int or byte arrays of order of 1mb. read there lot of ways make on windows (put c in dll called main c# app via p/invoke, build 2 different executables “talking” through pipes or sockets, shared memory, data copy, etc. etc.), found few comparisons between them.

the criteria 1) manly performance (less data exchange lag wins), 2) simplicity , ability keep c code more pure , plain possible (no hybrid languages c++/cli).

so, best strategy solve problem?

since you're not elaborating on computation hard tell best approach you.
have used possible "mathematical tricks" (it has been time since studied numeric analysis @ university there excellent books around that).
if want call c code application, bare in mind 2 things:
a. if use ipc, can slow things down, unless make 1 call input, , output, don't make x calls process process b.

b. if use 1 process (c# calling c, possible in java using jni/jna, , know possible in c# well), make sure c code "stable", if crashes, c# part crash (in first approach "c process" crashes while c# process alive (and "c process" can clustered or can automatically started using watchdog).


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -