On 20 jan, 23:26, bfrederi <[email protected]> wrote:
> I have a general question about creating a response in Django.
>
> If I am creating a response using the return
> django.shortcuts.render_to_response function:
>
> return render_to_response(
>     'template_name.html',
>     {'huge_dictionary_of_data': huge_dictionary_of_data,},
>     RequestContext(request, {}),
> )
>
> And the data that I am using to render the template with is 2Mb in
> size or more, is it more taxing on Django (Apache-mod_python) than
> just taking the parts that I need from that giant 2Mb dictionary of
> data and rendering it that way?
>
> I just wanted to know if it would be a significant difference if I
> passed the whole dictionary versus just the parts I need to
> render_to_response?

If it's a normal Python dict, then it doesn't make any difference (at
least wrt/ resource usage), since Python doesn't copy objects passed
as arguments to functions (FWIW, Python never copy anything unless
explicitely asked for).

But I stronly suggest you find a way to avoid loading 2mb dataset if
you only need a subpart of it...
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to