Skip to content

Commit

Permalink
links auto replaced
Browse files Browse the repository at this point in the history
  • Loading branch information
axgkl authored and Gunther Klessinger committed Jun 24, 2020
1 parent f24bf48 commit dde78c6
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .README.tmpl.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---

author: gk
version: 20200625
version: 20200626

---

Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---

author: gk
version: 20200625
version: 20200626

---

Expand Down Expand Up @@ -1483,8 +1483,8 @@ Output:

```
item 2: 0.011s
item 3: 0.022s
item 4: 0.033s
item 3: 0.021s
item 4: 0.032s
item 5: 0.044s
item 1: 0.049s <----- not in order, blocked
item 6: 0.055s
Expand Down Expand Up @@ -1606,6 +1606,6 @@ thread: DummyThread-10065 blocking {'i': 7}


<!-- autogenlinks -->
[pycond.py#185]: https://github.com/axiros/pycond/blob/d0a00db75ebcd7b7f2ca63a25a3f51fcb1e002f9/pycond.py#L185
[pycond.py#491]: https://github.com/axiros/pycond/blob/d0a00db75ebcd7b7f2ca63a25a3f51fcb1e002f9/pycond.py#L491
[pycond.py#588]: https://github.com/axiros/pycond/blob/d0a00db75ebcd7b7f2ca63a25a3f51fcb1e002f9/pycond.py#L588
[pycond.py#185]: https://github.com/axiros/pycond/blob/373bf047e38fcdfd6e9cc3aaf47355c7f477567c/pycond.py#L185
[pycond.py#491]: https://github.com/axiros/pycond/blob/373bf047e38fcdfd6e9cc3aaf47355c7f477567c/pycond.py#L491
[pycond.py#588]: https://github.com/axiros/pycond/blob/373bf047e38fcdfd6e9cc3aaf47355c7f477567c/pycond.py#L588
35 changes: 32 additions & 3 deletions tests/test_rx_perf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

Rx, rx = pc.import_rx()

# set this higher and watch mem getting constant:
now, count, prnt = time.time, 10000, 0


Expand All @@ -35,9 +36,18 @@ def blocking(k, v, cfg, data, **kw):
return 3, v


perf = {}


def clear(p):
p.clear
p['lasti'] = 0
p['lastt'] = now()


class Tests:
cond = [
['i', 'lt', 1000000], # just make it a bit complex
['i', 'lt', 100000000], # just make it a bit complex
'and',
[[':odd', 'eq', 1], 'and_not', ['i', 'eq', 2]],
'and_not',
Expand All @@ -50,9 +60,21 @@ def test_perf_compare(self):
res = {}
print()

d = lambda i: {'i': i}
def stats(m):
i = m['i']
if i - perf['lasti'] > 1000:
p = perf
p['lasti'] = i
print(i, now() - p['lastt'])
p['lastt'] = now()

return m

def d(i):
return {'i': i}

def _measure(f):
clear(perf)
fn = f.__name__
t0 = now()
l = f()
Expand Down Expand Up @@ -93,7 +115,9 @@ def _rxrun(**kw):

# Rx.interval(0, scheduler=GS).pipe(
rxcond = rxop(**kw)
s = Rx.from_(range(count)).pipe(rx.map(d), rxcond, rx.take(count))
s = Rx.from_(range(count)).pipe(
rx.map(d), rxcond, rx.take(count), rx.map(stats)
)
s.subscribe(add, on_completed=unblock)
ev.wait()
if not kw:
Expand Down Expand Up @@ -123,6 +147,11 @@ def rxasync():
_measure(qual)
_measure(rxsync)
_measure(rxasync)
# to see that mem goes down after the greenlets are done:
# while True:
# time.sleep(5)
# breakpoint() # FIXME BREAKPOINT
# return
head = '%s Items' % count
print('\n'.join(('', head, '=' * len(head))))
[print('%9s' % k, v) for k, v in res.items()]
Expand Down

0 comments on commit dde78c6

Please sign in to comment.