emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Tim Cross <theophilusx@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: How to set time limit and memory limit for execution of source blocks
Date: Tue, 04 Feb 2020 18:23:21 +1100	[thread overview]
Message-ID: <87sgjq6ck6.fsf@gmail.com> (raw)
In-Reply-To: <CACabEsRh2SytfdaqP68A5mvcpm8DPMaNJHL_X==p9uFq9ZAgZg@mail.gmail.com>


This is probably something which would need to be addressed in the
interpreter/compiler of the language you are using rather than within
Emacs or org-mode.

I would suspect that in your case, you are best off tangling the source
blocks to create separate executable scripts/code which you then run
outside of Emacs itself. Running the code blocks from within
org-mode/Emacs is going to adversely impact on the execution time (it
will be slower) and complicates/muddies calculation of memory usage (you
really only want to count the memory used by the child process running
your code, not that of Emacs).

Using tangled source code files will also allow you to use OS tools for
timing and memory metrics (depending on what platform your on).

If your source code blocks are emacs-lisp, things are a little
different. There will still be some overhead which may impact on
performance. I don't think you can easily identify memory useage (i.e.
memory used by your source code as opposed to memory used by Emacs for
everything else).

Anoop GR <anoopemacs@gmail.com> writes:

> Dear Emacs hackers,
>
> Like all of you, I think orgmode is the best way to organise study notes.
>
> I am solving competitive programming questions from Topcoder.com
> There are strict guidelines on memory limit of 256MB and time limit of 2sec
> for solutions
>
> How do I enforce the same on my orgmode source blocks.
> I want the execution to stop whenever it exceeds the above limits on memory
> and time.
>
> Long live Emacs,
> Anoop


--
Tim Cross

  reply	other threads:[~2020-02-04  7:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-04  6:40 How to set time limit and memory limit for execution of source blocks Anoop GR
2020-02-04  7:23 ` Tim Cross [this message]
2020-02-05  5:16 ` stardiviner
2020-02-09 14:54 ` Ken Mankoff
2020-02-10  7:15   ` Anoop GR

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sgjq6ck6.fsf@gmail.com \
    --to=theophilusx@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).