587 |
589 |
588 def test_composite_deletion(self): |
590 def test_composite_deletion(self): |
589 with self.admin_access.repo_cnx() as cnx: |
591 with self.admin_access.repo_cnx() as cnx: |
590 personnes = [] |
592 personnes = [] |
591 t0 = time.time() |
593 t0 = time.time() |
592 for i in xrange(2000): |
594 for i in range(2000): |
593 p = cnx.create_entity('Personne', nom=u'Doe%03d'%i, prenom=u'John', sexe=u'M') |
595 p = cnx.create_entity('Personne', nom=u'Doe%03d'%i, prenom=u'John', sexe=u'M') |
594 personnes.append(p) |
596 personnes.append(p) |
595 abraham = cnx.create_entity('Personne', nom=u'Abraham', prenom=u'John', sexe=u'M') |
597 abraham = cnx.create_entity('Personne', nom=u'Abraham', prenom=u'John', sexe=u'M') |
596 for j in xrange(0, 2000, 100): |
598 for j in range(0, 2000, 100): |
597 abraham.cw_set(personne_composite=personnes[j:j+100]) |
599 abraham.cw_set(personne_composite=personnes[j:j+100]) |
598 t1 = time.time() |
600 t1 = time.time() |
599 self.info('creation: %.2gs', (t1 - t0)) |
601 self.info('creation: %.2gs', (t1 - t0)) |
600 cnx.commit() |
602 cnx.commit() |
601 t2 = time.time() |
603 t2 = time.time() |
608 self.info("commit deletion: %2gs", (t4 - t3)) |
610 self.info("commit deletion: %2gs", (t4 - t3)) |
609 |
611 |
610 def test_add_relation_non_inlined(self): |
612 def test_add_relation_non_inlined(self): |
611 with self.admin_access.repo_cnx() as cnx: |
613 with self.admin_access.repo_cnx() as cnx: |
612 personnes = [] |
614 personnes = [] |
613 for i in xrange(2000): |
615 for i in range(2000): |
614 p = cnx.create_entity('Personne', nom=u'Doe%03d'%i, prenom=u'John', sexe=u'M') |
616 p = cnx.create_entity('Personne', nom=u'Doe%03d'%i, prenom=u'John', sexe=u'M') |
615 personnes.append(p) |
617 personnes.append(p) |
616 cnx.commit() |
618 cnx.commit() |
617 t0 = time.time() |
619 t0 = time.time() |
618 abraham = cnx.create_entity('Personne', nom=u'Abraham', prenom=u'John', sexe=u'M', |
620 abraham = cnx.create_entity('Personne', nom=u'Abraham', prenom=u'John', sexe=u'M', |
619 personne_composite=personnes[:100]) |
621 personne_composite=personnes[:100]) |
620 t1 = time.time() |
622 t1 = time.time() |
621 self.info('creation: %.2gs', (t1 - t0)) |
623 self.info('creation: %.2gs', (t1 - t0)) |
622 for j in xrange(100, 2000, 100): |
624 for j in range(100, 2000, 100): |
623 abraham.cw_set(personne_composite=personnes[j:j+100]) |
625 abraham.cw_set(personne_composite=personnes[j:j+100]) |
624 t2 = time.time() |
626 t2 = time.time() |
625 self.info('more relations: %.2gs', (t2-t1)) |
627 self.info('more relations: %.2gs', (t2-t1)) |
626 cnx.commit() |
628 cnx.commit() |
627 t3 = time.time() |
629 t3 = time.time() |
628 self.info('commit creation: %.2gs', (t3 - t2)) |
630 self.info('commit creation: %.2gs', (t3 - t2)) |
629 |
631 |
630 def test_add_relation_inlined(self): |
632 def test_add_relation_inlined(self): |
631 with self.admin_access.repo_cnx() as cnx: |
633 with self.admin_access.repo_cnx() as cnx: |
632 personnes = [] |
634 personnes = [] |
633 for i in xrange(2000): |
635 for i in range(2000): |
634 p = cnx.create_entity('Personne', nom=u'Doe%03d'%i, prenom=u'John', sexe=u'M') |
636 p = cnx.create_entity('Personne', nom=u'Doe%03d'%i, prenom=u'John', sexe=u'M') |
635 personnes.append(p) |
637 personnes.append(p) |
636 cnx.commit() |
638 cnx.commit() |
637 t0 = time.time() |
639 t0 = time.time() |
638 abraham = cnx.create_entity('Personne', nom=u'Abraham', prenom=u'John', sexe=u'M', |
640 abraham = cnx.create_entity('Personne', nom=u'Abraham', prenom=u'John', sexe=u'M', |
639 personne_inlined=personnes[:100]) |
641 personne_inlined=personnes[:100]) |
640 t1 = time.time() |
642 t1 = time.time() |
641 self.info('creation: %.2gs', (t1 - t0)) |
643 self.info('creation: %.2gs', (t1 - t0)) |
642 for j in xrange(100, 2000, 100): |
644 for j in range(100, 2000, 100): |
643 abraham.cw_set(personne_inlined=personnes[j:j+100]) |
645 abraham.cw_set(personne_inlined=personnes[j:j+100]) |
644 t2 = time.time() |
646 t2 = time.time() |
645 self.info('more relations: %.2gs', (t2-t1)) |
647 self.info('more relations: %.2gs', (t2-t1)) |
646 cnx.commit() |
648 cnx.commit() |
647 t3 = time.time() |
649 t3 = time.time() |
650 |
652 |
651 def test_session_add_relation(self): |
653 def test_session_add_relation(self): |
652 """ to be compared with test_session_add_relations""" |
654 """ to be compared with test_session_add_relations""" |
653 with self.admin_access.repo_cnx() as cnx: |
655 with self.admin_access.repo_cnx() as cnx: |
654 personnes = [] |
656 personnes = [] |
655 for i in xrange(2000): |
657 for i in range(2000): |
656 p = cnx.create_entity('Personne', nom=u'Doe%03d'%i, prenom=u'John', sexe=u'M') |
658 p = cnx.create_entity('Personne', nom=u'Doe%03d'%i, prenom=u'John', sexe=u'M') |
657 personnes.append(p) |
659 personnes.append(p) |
658 abraham = cnx.create_entity('Personne', nom=u'Abraham', prenom=u'John', sexe=u'M') |
660 abraham = cnx.create_entity('Personne', nom=u'Abraham', prenom=u'John', sexe=u'M') |
659 cnx.commit() |
661 cnx.commit() |
660 t0 = time.time() |
662 t0 = time.time() |
667 |
669 |
668 def test_session_add_relations (self): |
670 def test_session_add_relations (self): |
669 """ to be compared with test_session_add_relation""" |
671 """ to be compared with test_session_add_relation""" |
670 with self.admin_access.repo_cnx() as cnx: |
672 with self.admin_access.repo_cnx() as cnx: |
671 personnes = [] |
673 personnes = [] |
672 for i in xrange(2000): |
674 for i in range(2000): |
673 p = cnx.create_entity('Personne', nom=u'Doe%03d'%i, prenom=u'John', sexe=u'M') |
675 p = cnx.create_entity('Personne', nom=u'Doe%03d'%i, prenom=u'John', sexe=u'M') |
674 personnes.append(p) |
676 personnes.append(p) |
675 abraham = cnx.create_entity('Personne', nom=u'Abraham', prenom=u'John', sexe=u'M') |
677 abraham = cnx.create_entity('Personne', nom=u'Abraham', prenom=u'John', sexe=u'M') |
676 cnx.commit() |
678 cnx.commit() |
677 t0 = time.time() |
679 t0 = time.time() |
684 |
686 |
685 def test_session_add_relation_inlined(self): |
687 def test_session_add_relation_inlined(self): |
686 """ to be compared with test_session_add_relations""" |
688 """ to be compared with test_session_add_relations""" |
687 with self.admin_access.repo_cnx() as cnx: |
689 with self.admin_access.repo_cnx() as cnx: |
688 personnes = [] |
690 personnes = [] |
689 for i in xrange(2000): |
691 for i in range(2000): |
690 p = cnx.create_entity('Personne', nom=u'Doe%03d'%i, prenom=u'John', sexe=u'M') |
692 p = cnx.create_entity('Personne', nom=u'Doe%03d'%i, prenom=u'John', sexe=u'M') |
691 personnes.append(p) |
693 personnes.append(p) |
692 abraham = cnx.create_entity('Personne', nom=u'Abraham', prenom=u'John', sexe=u'M') |
694 abraham = cnx.create_entity('Personne', nom=u'Abraham', prenom=u'John', sexe=u'M') |
693 cnx.commit() |
695 cnx.commit() |
694 t0 = time.time() |
696 t0 = time.time() |
701 |
703 |
702 def test_session_add_relations_inlined (self): |
704 def test_session_add_relations_inlined (self): |
703 """ to be compared with test_session_add_relation""" |
705 """ to be compared with test_session_add_relation""" |
704 with self.admin_access.repo_cnx() as cnx: |
706 with self.admin_access.repo_cnx() as cnx: |
705 personnes = [] |
707 personnes = [] |
706 for i in xrange(2000): |
708 for i in range(2000): |
707 p = cnx.create_entity('Personne', nom=u'Doe%03d'%i, prenom=u'John', sexe=u'M') |
709 p = cnx.create_entity('Personne', nom=u'Doe%03d'%i, prenom=u'John', sexe=u'M') |
708 personnes.append(p) |
710 personnes.append(p) |
709 abraham = cnx.create_entity('Personne', nom=u'Abraham', prenom=u'John', sexe=u'M') |
711 abraham = cnx.create_entity('Personne', nom=u'Abraham', prenom=u'John', sexe=u'M') |
710 cnx.commit() |
712 cnx.commit() |
711 t0 = time.time() |
713 t0 = time.time() |