Skip to content

Commit fcb0298

Browse files
committed
Add performance figures
1 parent 3fbb36a commit fcb0298

1 file changed

Lines changed: 89 additions & 1 deletion

File tree

source_code/knights_tour.ipynb

Lines changed: 89 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -713,6 +713,94 @@
713713
" print(is_valid_knights_tour(tour))"
714714
]
715715
},
716+
{
717+
"cell_type": "markdown",
718+
"id": "ef5767e0-5114-4b30-8878-80f0150cd583",
719+
"metadata": {},
720+
"source": [
721+
"# Performance"
722+
]
723+
},
724+
{
725+
"cell_type": "code",
726+
"execution_count": 14,
727+
"id": "40a8b572-00bd-4e2d-b5f4-419820d8d650",
728+
"metadata": {},
729+
"outputs": [
730+
{
731+
"name": "stdout",
732+
"output_type": "stream",
733+
"text": [
734+
"68.9 µs ± 1.13 µs per loop (mean ± std. dev. of 7 runs, 10,000 loops each)\n"
735+
]
736+
}
737+
],
738+
"source": [
739+
"%timeit find_tour(5)"
740+
]
741+
},
742+
{
743+
"cell_type": "code",
744+
"execution_count": 15,
745+
"id": "c36f323f-7f21-4a00-b526-72e5c7ccf8a8",
746+
"metadata": {},
747+
"outputs": [
748+
{
749+
"name": "stdout",
750+
"output_type": "stream",
751+
"text": [
752+
"10.3 ms ± 61.5 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)\n"
753+
]
754+
}
755+
],
756+
"source": [
757+
"%timeit find_tour(6)"
758+
]
759+
},
760+
{
761+
"cell_type": "code",
762+
"execution_count": 16,
763+
"id": "6cecf705-03ce-45fe-815e-15928a32c4dc",
764+
"metadata": {},
765+
"outputs": [
766+
{
767+
"name": "stdout",
768+
"output_type": "stream",
769+
"text": [
770+
"26.7 s ± 497 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)\n"
771+
]
772+
}
773+
],
774+
"source": [
775+
"%timeit find_tour(7)"
776+
]
777+
},
778+
{
779+
"cell_type": "code",
780+
"execution_count": 17,
781+
"id": "f216d2ec-29f3-4f6c-8f43-e7e57b509245",
782+
"metadata": {},
783+
"outputs": [
784+
{
785+
"name": "stdout",
786+
"output_type": "stream",
787+
"text": [
788+
"8.79 s ± 49.7 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)\n"
789+
]
790+
}
791+
],
792+
"source": [
793+
"%timeit find_tour(8)"
794+
]
795+
},
796+
{
797+
"cell_type": "markdown",
798+
"id": "c3693282-403e-4fa6-ba41-479774d8dbc3",
799+
"metadata": {},
800+
"source": [
801+
"The runtime increases rapidly."
802+
]
803+
},
716804
{
717805
"cell_type": "markdown",
718806
"id": "b4b1938f-8e9e-43bb-a404-b7d2aa03084a",
@@ -746,7 +834,7 @@
746834
"name": "python",
747835
"nbconvert_exporter": "python",
748836
"pygments_lexer": "ipython3",
749-
"version": "3.11.3"
837+
"version": "3.11.2"
750838
}
751839
},
752840
"nbformat": 4,

0 commit comments

Comments
 (0)