NextMove Software
  • Home
  • Products
  • Technology
  • About Us

Corporate Offices

NextMove Software
Innovation Centre
320 Cambridge Science Park
Milton Road
Cambridge
England
CB4 0WG
General Inquiries: info@nextmovesoftware.com
Support: support@nextmovesoftware.com

JIT Compilation

Example #2: LINGOs Similarity

A significantly more complex application of just-in-time optimizing compilation is the use of one-the-fly code generation to improve the performance of molecular similarity searches. LINGOs is a measure of similarity between two molecules represented as SMILES strings. The machine code below demonstrates an "industrial" example of the x86 code generated for efficiently matching a database SMILES string against a known query string. The result is that the run-time code below offers significantly faster database queries than possible with optimized C/C++ implementing the same algorithm.

match:	push %ebp
	movl %esp,%ebp
	push %edi
	push %esi
	push %ebx
	subl $delta, %esp
	movl $qhist, %esi
	movl %esp, %edi
	movl $ucount, %ecx
	rep movsl
	movl 8(%ebp), %ecx
	xorl %ebx, %ebx 
	leal $icount(%esp), %edi
	movzbl (%ecx), %edx
	movzbl $map(%edx), %edx
	cmpl $tcount, %edx
	je zero
	movzwl $fsm(%edx,%edx), %eax
	addl $1, %ecx
	movzbl (%ecx), %edx
	movzbl $map(%edx), %edx
	cmpl $tcount, %edx
	je zero
	leal $fsm(%edx,%edx), %esi
	imull $tcount, %eax, %eax
	movzwl (%esi,%eax,2), %eax
	addl $1, %ecx
	movzbl (%ecx), %edx
	movzbl $map(%edx), %edx
	cmpl $tcount, %edx
	je zero
	leal $fsm(%edx,%edx), %esi
	imull $tcount, %eax, %eax
	movzwl (%esi,%eax,2), %eax
	addl $1, %ecx
	movzbl (%ecx), %edx
	movzbl $map(%edx), %edx
	cmpl $tcount, %edx
	je zero
loop:	leal $fsm(%edx,%edx), %esi
	imull $tcount, %eax, %eax
	movzwl (%esi,%eax,2), %eax
	cmpl $icount, %eax
	jb skip
	leal (%edi,%eax,2), %esi
	movzwl (%esi), %edx
	subl $1, %edx
	jb skip
	movw %dx, (%esi)
	addl $1, %ebx
skip:	addl $1, %ecx
	movzbl (%ecx), %edx
	movzbl $map(%edx), %edx
	cmpl $tcount, %edx
	jne loop
	subl 8(%ebp), %ecx
	subl $3, %ecx
	jbe zero
	movl %ebx, (%esp)
	fidl (%esp)
	movl $wcount, %eax
	addl %ecx, %eax
	subl %ebx, %eax
	movl %eax, (%esp)
	fidl (%esp)
	fdivrp %st, %st(1)
	leal -12(%ebp), %esp
	pop %ebx
	pop %esi
	pop %edi
	pop %ebp
	ret

zero:	fldz
	leal -12(%ebp), %esp
	pop %ebx
	pop %esi
	pop %edi
	pop %ebp
	ret
©2025 NextMove Software. All rights reserved.