SWIG-wrapped LIGOTimeGPS is very slow
Summary
I have noticed that with recent versions of LAL/LALsuite the SWIG-wrapped LIGOTimeGPS
object has become much, much slower when creating a new object. Does anyone know the reason for this, and can it be fixed to get the previous speed back?
This causes issues for creating long continuous wave signal simulations were LIGOTimeGPS
values are being used as the time stamps.
Steps to reproduce
If I do the following and install LALSuite 6.82 in a Python 3.7 environment:
$ conda create -n oldlal python=3.7
$ conda activate oldlal
$ pip install ipython lalsuite==6.82
then run the following in an iPython terminal:
import lal
print(lal.__version__)
7.1.2
seconds = 1357377318
nanoseconds = 0
%timeit lal.LIGOTimeGPS(seconds, nanoseconds)
249 ns ± 0.93 ns per loop (mean ± std. dev. of 7 runs, 1000000 loops each)
So, a single creation of a LIGOTimeGPS
object is very quick.
However, if I install the latest LALSuite in a Python 3.8 environmemt:
$ conda create -n newlal python=3.8
$ conda activate newlal
$ pip install ipython lalsuite
then run the following in an iPython terminal:
import lal
print(lal.__version__)
7.3.1
seconds = 1357377318
nanoseconds = 0
%timeit lal.LIGOTimeGPS(seconds, nanoseconds)
3.39 ms ± 24.6 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
So, it's almost 14000 times slower!
Context/Environment
System information
Hostname:Platform: Linux-5.15.0-84-generic-x86_64-with-glibc2.10
Conda information
Conda info for first environment (oldlal
)
active environment : oldlal
active env location : /home/matt/miniconda3/envs/oldlal
shell level : 2
user config file : /home/matt/.condarc
populated config files : /home/matt/.condarc
conda version : 23.7.4
conda-build version : not installed
python version : 3.8.17.final.0
virtual packages : __archspec=1=x86_64
__cuda=12.0=0
__glibc=2.31=0
__linux=5.15.0=0
__unix=0=0
base environment : /home/matt/miniconda3 (writable)
conda av data dir : /home/matt/miniconda3/etc/conda
conda av metadata url : None
channel URLs : https://conda.anaconda.org/conda-forge/linux-64
https://conda.anaconda.org/conda-forge/noarch
https://repo.anaconda.com/pkgs/main/linux-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/r/linux-64
https://repo.anaconda.com/pkgs/r/noarch
package cache : /home/matt/miniconda3/pkgs
/home/matt/.conda/pkgs
envs directories : /home/matt/miniconda3/envs
/home/matt/.conda/envs
platform : linux-64
user-agent : conda/23.7.4 requests/2.31.0 CPython/3.8.17 Linux/5.15.0-84-generic ubuntu/20.04.6 glibc/2.31
UID:GID : 1001:1001
netrc file : None
offline mode : False
Conda info for second environment (newlal
)
active environment : newlal
active env location : /home/matt/miniconda3/envs/newlal
shell level : 2
user config file : /home/matt/.condarc
populated config files : /home/matt/.condarc
conda version : 23.7.4
conda-build version : not installed
python version : 3.8.17.final.0
virtual packages : __archspec=1=x86_64
__cuda=12.0=0
__glibc=2.31=0
__linux=5.15.0=0
__unix=0=0
base environment : /home/matt/miniconda3 (writable)
conda av data dir : /home/matt/miniconda3/etc/conda
conda av metadata url : None
channel URLs : https://conda.anaconda.org/conda-forge/linux-64
https://conda.anaconda.org/conda-forge/noarch
https://repo.anaconda.com/pkgs/main/linux-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/r/linux-64
https://repo.anaconda.com/pkgs/r/noarch
package cache : /home/matt/miniconda3/pkgs
/home/matt/.conda/pkgs
envs directories : /home/matt/miniconda3/envs
/home/matt/.conda/envs
platform : linux-64
user-agent : conda/23.7.4 requests/2.31.0 CPython/3.8.17 Linux/5.15.0-84-generic ubuntu/20.04.6 glibc/2.31
UID:GID : 1001:1001
netrc file : None
offline mode : False
Conda environment
Conda environment for oldlal
# packages in environment at /home/matt/miniconda3/envs/oldlal:
#
# Name Version Build Channel
_libgcc_mutex 0.1 conda_forge conda-forge
_openmp_mutex 4.5 2_gnu conda-forge
backcall 0.2.0 pypi_0 pypi
ca-certificates 2023.7.22 hbcca054_0 conda-forge
cffi 1.15.1 pypi_0 pypi
cryptography 41.0.4 pypi_0 pypi
cycler 0.11.0 pypi_0 pypi
decorator 5.1.1 pypi_0 pypi
fonttools 4.38.0 pypi_0 pypi
ipython 7.34.0 pypi_0 pypi
jedi 0.19.0 pypi_0 pypi
kiwisolver 1.4.5 pypi_0 pypi
lalsuite 6.82 pypi_0 pypi
ld_impl_linux-64 2.40 h41732ed_0 conda-forge
libffi 3.4.2 h7f98852_5 conda-forge
libgcc-ng 13.2.0 h807b86a_2 conda-forge
libgomp 13.2.0 h807b86a_2 conda-forge
libnsl 2.0.0 hd590300_1 conda-forge
libsqlite 3.43.0 h2797004_0 conda-forge
libstdcxx-ng 13.2.0 h7e041cc_2 conda-forge
libzlib 1.2.13 hd590300_5 conda-forge
ligo-segments 1.4.0 pypi_0 pypi
lscsoft-glue 3.0.1 pypi_0 pypi
matplotlib 3.5.3 pypi_0 pypi
matplotlib-inline 0.1.6 pypi_0 pypi
ncurses 6.4 hcb278e6_0 conda-forge
numpy 1.21.6 pypi_0 pypi
openssl 3.1.3 hd590300_0 conda-forge
packaging 23.1 pypi_0 pypi
parso 0.8.3 pypi_0 pypi
pexpect 4.8.0 pypi_0 pypi
pickleshare 0.7.5 pypi_0 pypi
pillow 9.5.0 pypi_0 pypi
pip 23.2.1 pyhd8ed1ab_0 conda-forge
prompt-toolkit 3.0.39 pypi_0 pypi
ptyprocess 0.7.0 pypi_0 pypi
pycparser 2.21 pypi_0 pypi
pygments 2.16.1 pypi_0 pypi
pyopenssl 23.2.0 pypi_0 pypi
pyparsing 3.1.1 pypi_0 pypi
pyrxp 3.0.1 pypi_0 pypi
python 3.7.12 hf930737_100_cpython conda-forge
python-dateutil 2.8.2 pypi_0 pypi
readline 8.2 h8228510_1 conda-forge
scipy 1.7.3 pypi_0 pypi
setuptools 68.2.2 pyhd8ed1ab_0 conda-forge
six 1.16.0 pypi_0 pypi
sqlite 3.43.0 h2c6b66d_0 conda-forge
tk 8.6.13 h2797004_0 conda-forge
traitlets 5.9.0 pypi_0 pypi
typing-extensions 4.7.1 pypi_0 pypi
wcwidth 0.2.6 pypi_0 pypi
wheel 0.41.2 pyhd8ed1ab_0 conda-forge
xz 5.2.6 h166bdaf_0 conda-forge
Conda environment for newlal
# packages in environment at /home/matt/miniconda3/envs/newlal:
#
# Name Version Build Channel
_libgcc_mutex 0.1 conda_forge conda-forge
_openmp_mutex 4.5 2_gnu conda-forge
astropy 5.2.2 pypi_0 pypi
asttokens 2.4.0 pypi_0 pypi
backcall 0.2.0 pypi_0 pypi
bzip2 1.0.8 h7f98852_4 conda-forge
ca-certificates 2023.7.22 hbcca054_0 conda-forge
cffi 1.16.0 pypi_0 pypi
contourpy 1.1.1 pypi_0 pypi
cryptography 41.0.4 pypi_0 pypi
cycler 0.11.0 pypi_0 pypi
decorator 5.1.1 pypi_0 pypi
executing 1.2.0 pypi_0 pypi
fonttools 4.42.1 pypi_0 pypi
importlib-resources 6.1.0 pypi_0 pypi
ipython 8.12.2 pypi_0 pypi
jedi 0.19.0 pypi_0 pypi
kiwisolver 1.4.5 pypi_0 pypi
lalsuite 7.19 pypi_0 pypi
ld_impl_linux-64 2.40 h41732ed_0 conda-forge
libffi 3.4.2 h7f98852_5 conda-forge
libgcc-ng 13.2.0 h807b86a_2 conda-forge
libgomp 13.2.0 h807b86a_2 conda-forge
libnsl 2.0.0 hd590300_1 conda-forge
libsqlite 3.43.0 h2797004_0 conda-forge
libuuid 2.38.1 h0b41bf4_0 conda-forge
libzlib 1.2.13 hd590300_5 conda-forge
ligo-segments 1.4.0 pypi_0 pypi
lscsoft-glue 3.0.1 pypi_0 pypi
matplotlib 3.7.3 pypi_0 pypi
matplotlib-inline 0.1.6 pypi_0 pypi
ncurses 6.4 hcb278e6_0 conda-forge
numpy 1.24.4 pypi_0 pypi
openssl 3.1.3 hd590300_0 conda-forge
packaging 23.1 pypi_0 pypi
parso 0.8.3 pypi_0 pypi
pexpect 4.8.0 pypi_0 pypi
pickleshare 0.7.5 pypi_0 pypi
pillow 10.0.1 pypi_0 pypi
pip 23.2.1 pyhd8ed1ab_0 conda-forge
prompt-toolkit 3.0.39 pypi_0 pypi
ptyprocess 0.7.0 pypi_0 pypi
pure-eval 0.2.2 pypi_0 pypi
pycparser 2.21 pypi_0 pypi
pyerfa 2.0.0.3 pypi_0 pypi
pygments 2.16.1 pypi_0 pypi
pyopenssl 23.2.0 pypi_0 pypi
pyparsing 3.1.1 pypi_0 pypi
pyrxp 3.0.1 pypi_0 pypi
python 3.8.17 he550d4f_0_cpython conda-forge
python-dateutil 2.8.2 pypi_0 pypi
pyyaml 6.0.1 pypi_0 pypi
readline 8.2 h8228510_1 conda-forge
scipy 1.10.1 pypi_0 pypi
setuptools 68.2.2 pyhd8ed1ab_0 conda-forge
six 1.16.0 pypi_0 pypi
stack-data 0.6.2 pypi_0 pypi
tk 8.6.13 h2797004_0 conda-forge
traitlets 5.10.1 pypi_0 pypi
typing-extensions 4.8.0 pypi_0 pypi
wcwidth 0.2.6 pypi_0 pypi
wheel 0.41.2 pyhd8ed1ab_0 conda-forge
xz 5.2.6 h166bdaf_0 conda-forge
zipp 3.17.0 pypi_0 pypi