Subject: [Instant] Instant cache problem

From: Anders Logg <[email-masked]>
Date: Fri, 12 Feb 2010 10:50:12 +0100

The following unit test is failing for Instant:

  python -c "import instant; assert
  instant.import_module('((test19_signature_module))', 'test19_cache')
  is not None"
  t = 1.497633  ((1) With signature)
  t = 1.499479  ((2) With signature)
  Traceback (most recent call last):
    File "test19.py", line 120, in <module>
      assert t1 > t2

The following test seems to fail:

  # Build and rebuild with generic signature object
  sig = Sig("((test19_signature_module))")
  tic()
  module = build_module(code=c_code, signature=sig, cache_dir=cache_dir)
  assert module is not None
  t1 = toc("(1) With signature")
  tic()
  module = build_module(code=c_code, signature=sig, cache_dir=cache_dir)
  assert module is not None
  t2 = toc("(2) With signature")
  assert t1 > t2
  tic()
  module = import_module(sig, cache_dir)
  assert module is not None
  t3 = toc("(3) import_module")
  assert t1 > t3

When I run the test, I get t1 = t2 = t3 (approximately). Which one is
larger is somewhat random so the buildbot will fail sometimes but
sometimes not.

If I uncomment the lines that Garth commented out, I get

  t = 2.003596  ((1) With signature)
  t = 0.501644  ((2) With signature)
  t = 0.500951  ((3) import_module)

Does anyone know what this test does and what it should do?

--
Anders

---

From: "Garth N. Wells" <[email-masked]>
Date: Fri, 12 Feb 2010 10:22:49 +0000

> Does anyone know what this test does and what it should do?

It wasn't clear to me. It's not even clear from the output whether an
Instant test passes or fails.

Garth

> --
> Anders
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~instant
> Post to     : [email-masked]
> Unsubscribe : https://launchpad.net/~instant
> More help   : https://help.launchpad.net/ListHelp

---

From: [email-masked]
Date: Fri, 12 Feb 2010 11:28:22 +0100

I'll have a look.

Kent

---

From: Anders Logg <[email-masked]>
Date: Fri, 12 Feb 2010 21:02:43 +0100

If we can't figure this out now, I suggest we comment out that unit
test and make a new release. It fixes a memory leak (which may well be
the fault of FFC) but let's look at it after the release.

--
Anders

---

From: Anders Logg <[email-masked]>
Date: Sun, 14 Feb 2010 22:29:23 +0100

This test seems to work now for me, with and without instant-clean:

 python -c "import instant; assert
 instant.import_module('((test19_signature_module))', 'test19_cache')
 is not None"
 t = 2.003545  ((1) With signature)
 t = 0.501446  ((2) With signature)
 t = 0.500733  ((3) import_module)

I'm pretty sure I didn't touch anything. Does it work/fail for anyone
else?

--
Anders

---

From: "Garth N. Wells" <[email-masked]>
Date: Sun, 14 Feb 2010 22:04:52 +0000

I get the below.

Garth

--- Instant: compiling ---
t = 3.736186  ((1) With modulename)
t = 0.002224  ((2) With modulename)
python -c "import test19_ext"
--- Instant: compiling ---
t = 3.776908  ((1) With signature)
t = 0.000476  ((2) With signature)
t = 0.000020  ((3) import_module)
python -c "import instant; assert
instant.import_module('test19_signature_module', 'test19_cache') is not
None"
--- Instant: compiling ---
t = 2.388674  ((1) With signature)
t = 0.000467  ((2) With signature)
t = 0.000020  ((3) import_module)
python -c "import instant; assert
instant.import_module('((test19_signature_module))', 'test19_cache') is
not None"
t = 1.502452  ((1) With signature)
t = 1.501916  ((2) With signature)
t = 1.500936  ((3) import_module)
--- Instant: compiling ---
t = 3.925416  ((1) Without modulename or signature)
t = 0.000864  ((2) Without modulename or signature)

---

From: "Garth N. Wells" <[email-masked]>
Date: Sun, 14 Feb 2010 22:08:17 +0000

> the fault of FFC) but let's look at it after the release.

I don't think that it's an FFC problem. Instant inserted the memory
address of an object that has a signature string into the cache
dictionary. Doesn't make sense to me. The naming of objects in the
Instant function are questionable, which increases the likelihood that
it's an error.

Garth

---

From: Anders Logg <[email-masked]>
Date: Sun, 14 Feb 2010 23:13:04 +0100

> t = 0.000864  ((2) Without modulename or signature)

Now it fails for me again. My system seems to behave randomly today...

python -c "import instant; assert
instant.import_module('((test19_signature_module))', 'test19_cache')
is not None"
t = 1.502965  ((1) With signature)
t = 1.503044  ((2) With signature)
Traceback (most recent call last):
  File "test19.py", line 120, in <module>
    assert t1 > t2
AssertionError

I'll disable that unit test and add a bug report for someone to look
at later.

--
Anders