Hellooooooooooooooooooo Guys !!!!

And friend of mine [1] and I were talking about code yesterday, and we had
a super fancy idea that we do not know how to implement, and it would be so
so nice if we could do that in Sage.

We were dreaming of a new type of profiler. Right now, if you do something
like

sage: %prun yourfunction()

What you will get is a list of things that are being called by
yourfunction(), the time it takes, and all that.

Wouldn't it be *GREAT* if instead of telling you how much time is spent on
each thing it could tell you the theoretical complexity ?

Like :
%prun_of_death_with_chocolate_chips yourfunction(a_graph) # Because it has
to be a graph
INPUT : graph on n vertices and m edges
- This thing is called "4/3 n^3 + 15" times
- This one is called "2n^2" times, ...

And it could even somehow tell us that the function itself is of complexity
<something> !

So here are the few things we noticed :
- As knowing that a method terminates is already hard to do, it would be
necessary to add from time to time an information on the complexity of some
for/while loops in the code. For some other easy loops, the computer should
be able to guess it by itself
- It would be nice to find a way to differentiate the complexity of a n^2
Python code and a n^2 Cython code. Actually, if the computer knows that a
loop is executed n^2 times, it would be nice if it were able to compute the
number of cycles (or whatever you may think of, I really have no idea)
necessary for each loop. And this would put the factor in front of the n^2,
that we would not have to compute manually. And this would be sufficient to
indicate the difference between a very expensive n^2 loop and a cheap one.
- We could also add manually the complexity of some functions when
necessary, to their docstring or as comments in the code
- We should also be able to indicate which "variables" should be used to
compute the complexity. And as Sage is probably able to "guess" that 1 + 2
+ ... + n is equal to n(n+1)/2 perhaps we could use these symbolic
computations to help us deduce a nice form for the complexity of a
function. That's for the case when you have two loops like
for i in range(n):
   for j in range(i)

Anyway guys, we are writing a general-purpose math software. So for a start
it would be nice if the complexity of the methods we write was available
somewhere, and who but us could be interested in writing such a thing ? It
would be GREAT for education purposes, it would be the kind of bridges
between computers and theory that we spend our lifetimes building, and of
course it would be a totally super-awesome fancy gadget that we could boast
about when we begin to bore everybody around us saying how great Sage is.

We need it. Especially because we never needed it before.

Anyway it's super fancy.

What do you think ? I have no idea on earth how such a thing should be
implemented, at some point we will have to parse the Python code that we
write ourselves, I have no idea how we could get some part of the info
automatically, but it would be super great.

So, so, what do you think ???

Have
fuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuunnn
!!!

Nathann

[1] He's named Brice Onfroy, he's a cool guy and he may also help us
implement a cool graph drawing interface eventually !
http://www.onfroy-brice.eu/

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to