summaryrefslogtreecommitdiff
path: root/src/lib/eio
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2019-08-08 23:55:40 +0100
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2019-08-08 23:57:02 +0100
commit9149767184bfa9b64102eaea89f6733351de71e9 (patch)
tree1f2bdb7527a00f9ae3c8dd21fbf5a88cd305dfe4 /src/lib/eio
parentcdb920ab084451c8395dea605d96d2bad277ce61 (diff)
getenv - reduce continually calling getenv for the same vars do once
do it once and remember the result from the first one. drops overhead for sure by a chunk i actually could see in perf reports like about 1-2% of cpu...
Diffstat (limited to 'src/lib/eio')
-rw-r--r--src/lib/eio/eio_monitor.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/lib/eio/eio_monitor.c b/src/lib/eio/eio_monitor.c
index 84262bb..bc1ed07 100644
--- a/src/lib/eio/eio_monitor.c
+++ b/src/lib/eio/eio_monitor.c
@@ -371,7 +371,14 @@ eio_monitor_stringshared_add(const char *path)
371 371
372 EINA_REFCOUNT_INIT(monitor); 372 EINA_REFCOUNT_INIT(monitor);
373 373
374 if (getenv("EIO_MONITOR_POLL")) 374 static signed char monpoll = -1;
375
376 if (monpoll == -1)
377 {
378 if (getenv("EIO_MONITOR_POLL")) monpoll = 1;
379 else monpoll = 0;
380 }
381 if (monpoll)
375 eio_monitor_fallback_add(monitor); 382 eio_monitor_fallback_add(monitor);
376 else 383 else
377 eio_monitor_backend_add(monitor); 384 eio_monitor_backend_add(monitor);